【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()
相关推荐
一只猫的梦11 分钟前
自动化模块 (Automation Module)
前端·chrome
workflower1 小时前
室内外配送机器人-应用路径
人工智能·机器学习·设计模式·矩阵·自动化
一只猫的梦1 小时前
AI 适配器架构
前端·chrome
Black蜡笔小新2 小时前
自动化AI算法训练服务器DLTM零代码私有化赋能智慧农业用AI智能视觉守护万亩良田
人工智能·算法·自动化
初雪云2 小时前
iOS 上架入门:证书、描述文件、IPA 上传到底是什么关系?
android·ios·自动化·产品经理·iphone
AC赳赳老秦5 小时前
传感器数据自动汇总:OpenClaw 采集多类传感器数据、清洗入库、生成趋势分析
java·人工智能·python·自动化·github·php·openclaw
曦尧5 小时前
Argo CD:面向 Kubernetes 的声明式 GitOps 持续交付工具
ai·自动化
ai_coder_ai6 小时前
编写自动化脚本,在自己后端服务中使用云原生Baas服务进行设备相关操作
数据库·云原生·自动化
2301_780303907 小时前
DevSecOps建设之自动化集成与部署 Jenkins教程和使用案例
运维·自动化·jenkins
HAPPY酷7 小时前
【ROS2】PyCharm 启动 Gazebo 仿真报错?从配置 Shell 到修复路径的全流程复盘
ide·chrome·pycharm