【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()
相关推荐
miaowu3577 小时前
AI智能体推动数字化转型:从流程自动化到决策辅助的完整路线图
大数据·人工智能·自动化
QYR-分析11 小时前
智能化自动化浪潮下,机器人末端执行器行业赛道发展全景解析
人工智能·机器人·自动化
workflower12 小时前
模型中心主义路径
大数据·人工智能·深度学习·机器学习·自动化·制造
Urbano12 小时前
卫衣全工序自动化智造科普:替代工位、设备选型与产能升级方案
大数据·人工智能·自动化
YangYang9YangYan15 小时前
2026自动化背景无项目经验转数据分析的可行性分析
运维·数据分析·自动化
Urbano17 小时前
工装夹克、职业单西口袋工艺自动化改造深度解析
运维·自动化
一孤程18 小时前
Pytest+Selenium搭建自动化框架-保姆级实战教程
selenium·自动化·pytest
C+-C资深大佬20 小时前
GitHub Actions 自动化运维实战:从零到一构建高效 CI/CD 流水线
运维·自动化·github
caimouse1 天前
Chrome V49 (49.0.2623.112) 在 ReactOS 上运行所需的系统依赖
chrome·reactos