【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()
相关推荐
qq_4260039615 小时前
启动playwright录制codegen生成自动化测试脚本
python·自动化
其实防守也摸鱼19 小时前
内网穿透与反向代理:原理、工具与实战指南
android·大数据·运维·安全·网络安全·自动化·渗透
森叶20 小时前
用远程调试端口自动化 Chrome 应用商店发布:做法、三个真坑,以及你必须知道的风险
自动化
懂软件的胡子个哥20 小时前
微信机器人为什么需要“回复候选”而不是所有 AI 内容直接发送
运维·微信·自动化·wechatapi·个人微信号二次开发
jingli921 小时前
多平台多店铺客服怎么统一接待?千牛/拼多多/抖音/京东/闲鱼/微信/快手切窗口太累,一个后台集中接管的七步落地方案(2026 实操版)
人工智能·自动化·用户运营
坚定信念,勇往无前1 天前
Playwright 的本质
自动化·网络爬虫
华科大胡子1 天前
Chrome 插件开发实战指南
chrome
Rosanci1 天前
谷歌浏览器插件开发实战指南:从 Hello World 到上架发布
大数据·人工智能·chrome·程序人生