【web自动化】指定chromedriver以及chrome路径

selenium自动化,指定chromedriver,以及chrome路径
===对应这篇文章,可以点击查看,详情===

python 复制代码
from selenium import webdriver

def get_driver():
    # 获取配置对象
    option = webdriver.ChromeOptions()
    option.add_experimental_option("detach", True)
    # 去掉自动化标识
    option.add_experimental_option('excludeSwitches', ['enable-automation'])
    option.add_argument('--disable-blink-features=AutomationControlled')
    # 关闭保存密码弹窗
    prefs = {}
    prefs['credentials_enable_service'] = False
    prefs['profile.password_manager_enabled'] = False
    option.add_experimental_option('prefs', prefs)
    # 驱动chromedriver路径
    driver_path = 'X:\Program Files (x86)\Chrome\ChromeCore\chromedriver_win32\chromedriver.exe'

    # 指定 Chrome 浏览器的可执行文件路径
    option.binary_location = r'X:\Program Files (x86)\Chrome\ChromeCore\ChromeCore.exe'

    driver = webdriver.Chrome(options=option, executable_path=driver_path)
    driver.implicitly_wait(10)
    time.sleep(1)
    driver.get('https://www.baidu.com')
    # return driver

get_driver()
相关推荐
GlobalSign数字证书4 小时前
小企业零运维 TLS 架构设计:证书生命周期管理(CLM)与自动化轮换策略的技术选型
运维·自动化
mCell4 小时前
谁在为 AI 开车:Agent 浏览器生态调研(2026)
chrome·macos·agent
小新讲网安7 小时前
云安全攻防实战:AWS与阿里云渗透测试全流程指南
安全·web安全·网络安全·阿里云·自动化·云计算·aws
纳米软件8 小时前
AIDC供电架构演进_从传统UPS到HVDC的测试挑战与验证方法
自动化·ate测试系统·aidc·服务器电源·电子测试测量
xiaoxiangsiyan9 小时前
RHCE2026云原生路线EX188和EX288完整备考指南
运维·网络·云原生·自动化
martindelophy10 小时前
Codex Chrome 插件 + Timeline Studio:构建可编辑的 AI 视频剪辑 Agent 工作流
前端·人工智能·chrome
yinshuzhineng10 小时前
如何提升生产线自动化水平,降低人工成本?
运维·人工智能·自动化·制造
wechatbot88811 小时前
极客互动企业微信 SCRM 私域运营实战效果全景
大数据·汇编·微信·自动化·企业微信·rpa
John_ToDebug13 小时前
把 Codex 变成工程认知系统:如何沉淀 Rules、Skills、Context、Architecture 与工程经验
人工智能·chrome·经验分享
weixin_4038101314 小时前
苹果群控带机量实测:一台电脑能稳定控多少台iPhone
自动化·iphone·跨境电商·苹果投屏·多媒体运营·安卓中控