【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()
相关推荐
维尔切4 小时前
自动化运维-ansible中对于大项目的管理
运维·自动化·ansible
半梦半醒*4 小时前
ansible阶段练习题
linux·运维·自动化·ansible·负载均衡·运维开发
双翌视觉7 小时前
智能相机还是视觉系统?一文讲透工业视觉两大选择的取舍之道
科技·数码相机·自动化·机器视觉
熊猫钓鱼>_>12 小时前
基于腾讯云MCP广场服务Firecrawl MCP网络采集服务构建自动化竞品监测工作日志
自动化·云计算·腾讯云
HappyAcmen12 小时前
【自动化实战】Python操作Excel/WORD/PDF:openpyxl与docx库详解
python·自动化·excel
q5673152312 小时前
无需Python:Shell脚本如何成为你的自动化爬虫引擎?
开发语言·爬虫·python·自动化·scala
aiden:)12 小时前
App UI 自动化环境搭建指南
运维·python·ui·appium·自动化
张3蜂12 小时前
CI/CD流水线驱动自动化流程深度解析:选型、竞品、成本与资源消耗
servlet·ci/cd·自动化
耐达讯通信技术12 小时前
耐达讯自动化RS485与Profinet双向奔赴,伺服驱动器连接“稳稳拿捏”
运维·人工智能·物联网·网络协议·自动化·信息与通信
耐达讯通信技术12 小时前
嘎嘎厉害!耐达讯自动化RS485转Profinet网关就是食品温控的“天选之子”
运维·服务器·网络·人工智能·网络协议·自动化·信息与通信