【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()
相关推荐
志栋智能6 小时前
迈向真正的超自动化巡检
运维·自动化
DianSan_ERP8 小时前
WMS接入电商平台自动化履约实战:一张订单从平台到出库的接口时序设计
java·前端·网络·数据库·安全·架构·自动化
志栋智能9 小时前
从安全超自动化到超自动化安全的认知飞跃
运维·安全·自动化
单友人11 小时前
HMHA-RYST 算法技能包 + 聊天记录导出器
人工智能·神经网络·机器学习·语言模型·自动化
FII工业富联科技服务12 小时前
从“单机自动化”到“技能复用”:从WRC 2026拆解机器人模型、仿真、部署与数据回流
人工智能·机器人·自动化
楠楠子呀12 小时前
号码验证技术解析:从原理到实践
运维·人工智能·ai·electron·自动化
科技小E14 小时前
自建团队、买SaaS、还是用自动化AI算法训练服务器DLTM?企业AI视觉三条路线算笔账
人工智能·深度学习·自动化
工业HMI实战笔记14 小时前
【拯救HMI】:工业自动化交互革命:HMI 触摸屏如何成为产线智能中枢
运维·自动化·交互
南讯股份Nascent15 小时前
2026专业私域用户运营平台怎么选?私域协同+会员通能力,五家实力企业领跑行业
自动化·用户运营
SEONIB_Explorer16 小时前
VEONIB 电商 UGC 视频自动化生产实战指南
人工智能·自动化·音视频·跨境电商·视频制作·veonib