【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()
相关推荐
Java陈序员6 小时前
用 AI 开发了一个 Github 图片预览浏览器插件!
chrome·edge·github·浏览器插件
海宇服务7 小时前
零信任架构实战:基于海宇个人大数据报告构建自动化汽车融资租赁资信核验网关
大数据·人工智能·架构·自动化
梯度下降者7 小时前
桌面应用自动化python——uiautomation API 如何找元素
python·自动化·窗口操作·uiautomation·控件识别
ai_coder_ai7 小时前
使用Web IDE边写自动化脚本
运维·前端·自动化
FII工业富联科技服务7 小时前
服务器开始按柜交付 数据中心需要具备怎样的承接能力
大数据·运维·服务器·人工智能·自动化·制造
迪康Defender7 小时前
PHP 高危漏洞应急分析:从风险原理到端点侧纵深防护
运维·开发语言·安全·自动化·php·运维开发·远程工作
虎鲸不是鱼8 小时前
AI 自动化逆向(二十二)换行比峰值法:让 AI 自己发现图像的宽度
人工智能·自动化·大模型·逆向·ai逆向
虎鲸不是鱼8 小时前
AI 自动化逆向(二十九)受保护区间的真实形状是「夹层」
人工智能·自动化·大模型·逆向·ai逆向
snpgroupcn8 小时前
SAP迁移工程下篇:模板复用、自动化执行与阶段内置校验的实现(下篇)
运维·自动化
虎鲸不是鱼10 小时前
AI 自动化逆向(二十五)数据表格式:一个恒等式覆盖 99% 的表
人工智能·自动化·大模型·逆向·ai逆向