【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()
相关推荐
志栋智能1 小时前
超自动化安全中的自适应防护与自愈能力
网络·安全·自动化
专业贴准12 小时前
苏州SMT供料器设备选型分析:本地主流自动化企业技术特点与行业趋势
人工智能·自动化·制造
技术深耕者13 小时前
AI Agent从演示到生产:企业进入“自动化层”时代
运维·人工智能·自动化
APItesterCris15 小时前
Open Claw 实战教程:5 分钟搭建京东商品自动化监控与数据分析系统
大数据·运维·数据库·数据仓库·自动化
de之梦-御风15 小时前
【工业自动化平台】 工程设计-项目分层目录设计(1)
自动化·.net
寒水馨19 小时前
macOS下载、安装PowerShell-v7.6.4(附安装包powershell-7.6.4-osx-arm64.pkg)
macos·自动化·跨平台·shell·脚本·命令行·powershell
起司喵喵19 小时前
推荐一款基于 Python 和 Rust 开发的跨平台 GUI 自动化库!
python·rust·自动化
你的秋裤穿反了21 小时前
二. 和利时添加硬件
自动化
AI的探索之旅21 小时前
BOM管理的AI自动化:从原理图到采购清单,我搭了一套全自动工具链
运维·人工智能·自动化
oh,huoyuyan1 天前
跨境电商自动化运营工具推荐:火车采集器 & 火语言RPA
大数据·自动化·rpa