【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()
相关推荐
勘察加熊人2 小时前
ai飞卢小说自动化处理工作流获得提问素材
运维·自动化
kyriewen113 小时前
异步编程:从“回调地狱”到“async/await”的救赎之路
开发语言·前端·javascript·chrome·typescript·ecmascript·html5
志栋智能5 小时前
告别高昂投入:超自动化IT运维的轻量化实践
大数据·运维·网络·人工智能·自动化
优选资源分享5 小时前
zTasker v2.3.8 便携版丨 Windows 自动化任务工具
运维·windows·自动化
梦想的旅途26 小时前
企微智能知识库:AI赋能私域流量
人工智能·自动化·企业微信
ljh5746491198 小时前
Linux find命令
linux·运维·chrome
东方不败之鸭梨的测试笔记8 小时前
基于RF自动化重跑
运维·自动化
纪伊路上盛名在8 小时前
Zerotier-Tailscale 自动化监控
linux·运维·自动化·内网穿透
无忧智库8 小时前
大型能源集团的数字中枢:EA框架如何驱动ERP系统从“流程自动化”迈向“智能决策”(PPT)
运维·自动化·能源
袖手蹲9 小时前
Arduino UNO Q 板载 Nanobot 自动化编程指南之二
运维·自动化