【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()
相关推荐
meiying88381 小时前
快递单号批量查询Python脚本:从手动到自动化的完整实现
开发语言·python·自动化
天远Date Lab2 小时前
零信任架构实战:基于天远企业年报信息核验构建自动化商业保理财务与社保穿透评估网关
人工智能·架构·自动化
codezzzsleep2 小时前
学术汇报 PPT 自动化生成实战指南
运维·自动化·powerpoint
leeguoo3 小时前
让 Claude Code / Codex 用上你已登录的 Chrome
前端·chrome·ai编程
福建佰胜张工5 小时前
费希尔 FIELDVUE™ DVC6200-AC 智能阀门定位器深度解析:双作用配置、核心参数与典型应用
运维·安全·自动化
NailiConveyor5 小时前
输送机机架怎么选材?碳钢、不锈钢、铝型材的成本与适用场景
大数据·运维·自动化·制造·业界资讯
骑着蜗牛撵大象3276 小时前
让 Codex 值夜班:把告警排查与巡检接成可回滚的自动化链路
android·java·运维·ai·自动化·codex·智能体
天远数科6 小时前
零信任架构实战:基于天远企业年报信息核验构建自动化供应商准入资质合规审查网关
运维·人工智能·架构·自动化
Shell运维手记8 小时前
Shell 脚本入门课堂讲解
前端·chrome
Profile排查笔记8 小时前
有哪些开源指纹浏览器项目?先核对客户端、内核与许可证
前端·人工智能·后端·自动化