【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()
相关推荐
千里码aicood10 小时前
基于PLC的简易三轴工件搬运平台设计
自动化·plc
科技研学社12 小时前
自动化缝制升级:支撑产业海外转移,降低建厂用工门槛
人工智能·自动化
懂软件的胡子个哥13 小时前
微信二次开发如何保护接口安全,Token、权限和重放防护都要考虑
微信·自动化·wechatapi·个人微信号二次开发·微信群管理
织码weavecodes16 小时前
离线学习与多端进度同步:在线心跳、Redis 缓冲与断点续考技术实现
大数据·自动化
iPad协议个微协议17 小时前
用 WechatApi 搭建微信自动化系统,需要哪些工程能力
微信·自动化·微信开发·wechatapi·个人微信号二次开发·微信ai客服·微信智能体ai
微三云 - 廖会灵 (私域系统开发)17 小时前
多端商城统一账号体系设计实践:小程序 / APP / H5 登录打通与账号合并
矩阵·重构·自动化·零售
szephyr18 小时前
用 Python 写自动化脚本:定时任务、文件批处理、自动出报表
python·自动化·pandas·脚本·定时任务
懂软件的胡子个哥20 小时前
微信二次开发如何设计高可用架构,服务器故障时消息不能跟着丢
微信·自动化·wechatapi·个人微信号二次开发·微信群管理
gongfeng30001 天前
福州企业级AI自动化获客解决方案品牌梳理与适用场景分析
运维·人工智能·自动化·g-claw ai员工