【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()
相关推荐
天远API30 分钟前
零信任架构实战:基于天远单人婚姻查询构建自动化联合贷款审计网关
java·人工智能·架构·自动化
工业机器人视觉检测设备44 分钟前
云汇智能金属网焊后剪切装置 非标自动化定制助力产线提质增效
自动化·自动化设备
2601_963906781 小时前
桌面自动化工具|零代码录制自动化,无需联网本地离线用
运维·自动化
海宇AI1 小时前
零信任架构实战:基于海宇公安二要素认证即时版构建自动化灵活用工准入网关
运维·人工智能·架构·自动化
科技研学社3 小时前
一次性内裤制造的工艺痛点与自动化工艺改良方案
人工智能·自动化
微三云 - 廖会灵 (私域系统开发)3 小时前
存量竞争下平台裂变的合规路径研究 —— 众薪广告积分模式机制、边界与落地风险
重构·自动化·零售
工业HMI实战笔记4 小时前
【拯救HMI】:自动化对外输出新范式:从设备出口到 “技术 + 服务” 全链条交付
运维·自动化
海宇大数据5 小时前
分布式网关架构实战:基于海宇数据公安二要素认证即时版构建自动化司机准入网关
人工智能·分布式·架构·自动化
摸鱼仙人~5 小时前
前端知识体系
chrome
wuhuhuan6 小时前
Case Generator 测试自动化平台
python·测试工具·自动化