【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()
相关推荐
天远API16 小时前
零信任架构实战:基于天远行驶OCR证识别构建自动化智能停车网关
运维·人工智能·架构·自动化
四方云17 小时前
低配4C4G服务器,10秒录音1秒转写!解决电销系统混合录音质检最大难题
大数据·人工智能·自动化·电销破局
handler0119 小时前
【Linux】ELF、链接与动态库,程序装载全解析
linux·运维·服务器·chrome·c·elf·文件
智塑未来20 小时前
短剧出海平台选择:技术视角下的翻译配音工具选型与自动化流程实战
运维·自动化·xcode
搞科研的小刘选手20 小时前
【计算机全领域稿件可收 | 东南大学自动化学院主办 | 苏州举办】第二届大数据应用、机电工程与自动化国际学术会议(BDAMEA 2026)
自动化·机电工程·会议推荐·大数据应用·东南大学自动化学院
A-刘晨阳20 小时前
K8s集群中的数据库新范式:KES-Operator解锁部署、扩缩容、备份全链路自动化
运维·数据库·云原生·kubernetes·自动化
志栋智能21 小时前
安全超自动化的治理框架与剧本(Playbook)管理
网络·安全·自动化
泛联新安21 小时前
“天神”空降:泛联新安受邀参加第八届“纵横”网络空间创新论坛
网络安全·自动化·代码规范·漏洞挖掘·代码安全·代码漏洞扫描·ai+可信开发
hhb_6181 天前
智能任务自动化协同AI工作流技术文档
运维·人工智能·自动化
可乐鸡翅yeah_1 天前
多浏览器 HLS 兼容性差异排查,Chrome、Firefox、Safari 表现不一致定位
chrome·ffmpeg·音视频·firefox·safari·m3u8