【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()
相关推荐
杜子腾dd5 小时前
17.Excel:实用的 VBA 自动化程序
数据分析·自动化·excel
奋斗者1号7 小时前
浏览器自动化与网络爬虫实战:工具对比与选型指南
运维·爬虫·自动化
一只专注api接口开发的技术猿7 小时前
1688 API 自动化采集实践:商品详情实时数据接口开发与优化
大数据·运维·数据库·自动化
powerfulzyh8 小时前
Docker中运行的Chrome崩溃问题解决
chrome·docker·容器
虚空之月&&轮舞者9 小时前
Python与矢量网络分析仪3671E:通道插损自动化校准(Vscode)
网络·python·自动化
workflower13 小时前
人协同的自动化需求分析
运维·开发语言·自动化·软件工程·需求分析·软件需求
代码的乐趣14 小时前
支持selenium的chrome driver更新到136.0.7103.92
chrome·python·selenium
富唯智能14 小时前
复合机器人案例启示:富唯智能如何以模块化创新引领工业自动化新标杆
人工智能·机器人·自动化
努力学习的小廉16 小时前
深入了解linux系统—— 自定义shell
linux·运维·chrome
画中有画18 小时前
一种安全不泄漏、高效、免费的自动化脚本平台
运维·安全·自动化·自动化脚本