【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()
相关推荐
Frag0ut11 小时前
获取Chrome官方安装包:离线版安装风险避坑指南
chrome·google·谷歌浏览器·安装包·chromesetup.exe·在线安装包·离线版
Python大数据分析@12 小时前
通过 MCP 实现 AI Agent自动化数据采集
运维·人工智能·爬虫·自动化
Initialize-le14 小时前
systemd 服务起不来?五步排查法
前端·chrome
HAHAXX814 小时前
淘宝RPA定时拉取交易数据实战:从人工录单报错到自动化对账全流程复盘
运维·自动化·rpa
虎鲸不是鱼14 小时前
【虎鲸进化论 09】活下去:自启、守护、探活
人工智能·自动化·大模型·llm·自进化agent
xixiaoyunya16 小时前
把网站状态巡检自动化:从“每天手动刷一遍”到秒级无人值守
运维·自动化
霍格沃兹测试学院-小舟畅学17 小时前
Playwright MCP:基于页面语义理解的元素定位与浏览器自动化操作
运维·自动化
智商网输送线配件18 小时前
电子制造零散耗材补货实战:小批量混批采购平台怎么选才不停机?
大数据·服务器·前端·数据库·自动化
虎鲸不是鱼19 小时前
【虎鲸进化论 07】给 AI 装上手和脚:MCP 协议与“给 Agent 用的工具“设计
人工智能·自动化·大模型·llm·自进化agent
海宇大数据20 小时前
零信任架构实战:基于海宇公安二要素认证即时版构建自动化证券账户实名鉴权网关
人工智能·架构·自动化·区块链