【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()
相关推荐
Qt云程序员2 小时前
选型参考:光刃RPA 与常见 RPA / 自动化方案的对比
人工智能·自动化·rpa
蒸鱼Yuzheng2 小时前
HarmonyOS HAP 与调试工件治理:包结构、版本身份与自动化证据链
自动化·性能测试·数据治理·harmonyos·hap
机核研创社2 小时前
短袖T恤+长裤怎么自动缝?一条自动化流水线的五台设备怎么分工详解
自动化
智能RPA3 小时前
农业与矿业行业智能体自动化平台对比评测(计量与巡检场景)
运维·人工智能·python·自动化·agent·rpa
TomEval3 小时前
【测AI】第05篇:Python 爬虫进阶 —— 动态页面爬取与 Scrapy 框架
人工智能·爬虫·python·scrapy·自动化
张彦峰ZYF3 小时前
从 ABC Legal 的 Managed Agents 实践,看企业如何把零散自动化变成可审计、可进化、可计算的生产系统
人工智能·自动化·prompt·agent·abc legal·managed agents·agent 平台
天天喝旺仔4 小时前
CI/CD 实战:GitHub Actions 自动化构建、测试与发布流水线
ci/cd·自动化·github·devops·持续集成
程序员-Benothing4 小时前
Shell脚本入门教程:Shebang、变量、注释与执行方式
前端·chrome
西索斯coding5 小时前
GPT-5.3-Codex 接口报 422 Unprocessable Entity 怎么办?排查到最后发现是 messages role 顺序校验的坑
chrome·gpt·ai·iphone
微信开发api5 小时前
基于WTAPI构建社群运营平台:自动拉群与会话承接链路设计
java·大数据·网络·数据库·微信·自动化