【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()
相关推荐
科技研学社41 分钟前
无纺布贴身制品非标自动化落地复盘:一次性内裤产线的工程难点与解决方案
运维·自动化
爱学堂IT课程大全1 小时前
零基础,Hermes Agent 多场景自动化实战
运维·人工智能·自动化
XiaoZhenHua982 小时前
C#工业机器视觉软件架构设计:从能运行的Demo到能够稳定跑产线的软件
计算机视觉·系统架构·自动化
TomEval2 小时前
【App 自动化】15 - App 自动化框架搭建
运维·自动化
摸鱼仙人~2 小时前
需求深度分析提示词-grill me
前端·chrome
天远API2 小时前
零信任架构实战:基于天远公安三要素即时版构建自动化理赔合规网关
人工智能·python·架构·自动化
运维全栈笔记2 小时前
Ansible 自动化 Nginx 集群部署实战:动态 Inventory、滚动发布与 Role 工程化
nginx·自动化·ansible
跨境小彭3 小时前
Temu 广告投放实操:ROAS 底层逻辑与批量广告作业方案
大数据·人工智能·自动化·temu
吴佳浩 Alben3 小时前
走向 Memory OS:企业私有化 Agent 设计与实现
人工智能·深度学习·神经网络·语言模型·架构·自动化·ai编程
工业机器人视觉检测设备13 小时前
工序全流程自动化升级!云汇智能打造汽车天窗多机器人集成产线
机器人·自动化·汽车