【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()
相关推荐
fthux2 小时前
不必下载整个仓库:GitZip Pro 让 GitHub 文件与文件夹批量下载更简单
前端·chrome·ai·edge·开源·github·firefox
YH行业报告分析2 小时前
销售拨号软件升级:智能销售场景下云端自动化如何提升企业获客效率?
运维·自动化
一水4 小时前
Pi :内置四工具源码拆解——文件锁、变更快照与 bash 隔离
开发语言·chrome·ai·bash
沪上企服通5 小时前
当 RPA 遇见企服:合规链路自动化的技术演进与五类市场样本观察
运维·自动化·rpa
Yang96117 小时前
API驱动自动化:鼎讯信通TM-150进测试系统
运维·自动化
qq_267612899 小时前
Gitee DevOps的度量驱动持续改进:从构建数据到交付效率的量化管理与优化路径
前端·gitee·自动化
小鹿软件办公9 小时前
iPhone 拍出来的视频是什么格式?HEVC 还是 H.264?
前端·chrome
VIP_CQCRE9 小时前
用 Ace Data Cloud Studio,把内容营销变成自动运行的 AI 工作流
ai·自动化·内容营销·mcp·acedatacloud
中才实用9 小时前
Jenkins自动化部署
运维·自动化·jenkins