【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()
相关推荐
fruge1 天前
前端自动化脚本:用 Node.js 写批量处理工具(图片压缩、文件重命名)
前端·node.js·自动化
代码对我眨眼睛1 天前
Ubuntu 系统 NVIDIA 显卡驱动自动化安装全流程
linux·ubuntu·自动化
spencer_tseng1 天前
Chrome settings for opening new tags
chrome
ToDetect2 天前
主流Chrome、Edge、Firefox 浏览器 User-Agent 解析完整操作指南
chrome·todetect·浏览器指纹检测·user-agent 解析
守城小轩2 天前
Chromium 140 编译指南 macOS 篇:基础环境准备(一)
chrome·macos·chrome devtools·指纹浏览器·浏览器开发·超级浏览器
施努卡机器视觉2 天前
SNK施努卡车门自动化安装
运维·自动化
2401_77CN2 天前
汇川Easy系列PLC封装一阶低通滤波器FC【双线性变换】(定时中断应用,固定步长求解)
笔记·自动化
二哈喇子!2 天前
在 Chrome 里通过 ZeroOmega 插件,接入亮数据的数据中心代理 IP
chrome·ai·代理ip·zeroomega插件·亮数据的数据中心代理方案
一晌小贪欢2 天前
【Python办公】用 Selenium 自动化网页批量录入
开发语言·python·selenium·自动化·python3·python学习·网页自动化
垂金烟柳2 天前
MongoDB GridFS 历史数据自动化清理实践
数据库·mongodb·自动化