【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 小时前
10-实战:RuoYi-Cloud的自动化发布
运维·ci/cd·自动化
迁移科技2 小时前
告别人工分拣!迁移科技 AI+3D 视觉让机器人 “看懂” 无序抓取
人工智能·科技·3d·机器人·自动化·视觉检测
xxx1x1x2 小时前
极客向:DLL/运行库故障的底层逻辑与自动化修复方案
运维·自动化·dll文件·dll·dll修复·dll缺失·dll一键修复
裴东青4 小时前
08-实战:RuoYi-Vue项目的自动化发布
ci/cd·自动化
施努卡机器视觉7 小时前
SNK施努卡铜箔包装线:从拔轴到入库,全流程自动化怎么实现?
运维·自动化
Agent手记7 小时前
安全生产巡检全流程自动化与隐患预警方案:2026工业Agent落地实战指南
数据库·人工智能·安全·ai·自动化
工业机器人销售服务7 小时前
在珠宝首饰加工中,遨博协作机器人配合微力控技术,实现宝石的自动化镶嵌
运维·机器人·自动化
企服AI产品测评局8 小时前
实测2026安全培训管理新范式:如何以“视觉大模型”破解AI内容生成与跨系统自动化难题?
人工智能·安全·ai·chatgpt·自动化
布吉岛的石头8 小时前
Java 程序员第 18 阶段:实战Agent工作流:Java搭建自动化业务智能体
java·python·自动化
志栋智能8 小时前
超自动化巡检:保障数字化转型的“底座工程”
运维·自动化