【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 小时前
AI Agent 如何“看懂“互联网?
爬虫·python·自动化·爬虫实战·多线程爬虫
zxcvb15311 小时前
规定备份信息的备份方式:从策略制定到自动化落地的实践思考
运维·oracle·自动化
eBest数字化转型方案13 小时前
经销商对账自动化:从五本账模型到票据识别的工程实现
运维·自动化
Elastic 中国社区官方博客13 小时前
AWS 自动化根因分析:从 CloudWatch 告警到完成故障诊断,仅需 36 秒
大数据·运维·elasticsearch·自动化·aws
xixiaoyunya14 小时前
高校教学资料备份:校园内网自动化备份完整方案
运维·自动化
浪子明X15 小时前
AI 日报自动化:先把事实、时间和引用做成可检查的编辑流水线
运维·人工智能·自动化
A-刘晨阳15 小时前
GitLab + ArgoCD 实现 Kubernetes GitOps 自动化部署
运维·人工智能·git·kubernetes·自动化·云计算·argocd
码士集团小青16 小时前
美团Tabbit实测:免费用GPT-5.5和Claude Opus 4.8,浏览器Agent自动化到底能干什么
运维·gpt·自动化
_upupup1 天前
Linux中的自动化构建——make/Makefile
linux·运维·自动化