【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()
相关推荐
Nuanyt16 分钟前
Linux系统的 Shell 常见指令和常见知识点(以bash为主)
linux·运维·chrome·bash
仙逆GPT22 分钟前
ChatGPT、Codex教程:Record & Replay怎么把重复操作变成可复用Skill?
chatgpt·自动化·codex·skills
weixin_446260854 小时前
claude desktop对metasploitable3自动化渗透技能研究
运维·自动化
奈斯先生Vector10 小时前
告别工具碎片化:基于 Nano Banana 全模态 AI 聚合架构搭建“文本-图像-视频”自动化协同生产线
运维·数据库·人工智能·架构·自动化·aigc·音视频
一可米13 小时前
gitHub.com Actions自动化发布
运维·自动化·github
酷可达拉斯14 小时前
自动化运维-ansible配置文件与主机清单
linux·运维·自动化·ansible
测试开发技术18 小时前
AI 测试提效 | 告别手工写脚本,分享我的 Playwright + Skill 批量生成 UI 自动化脚本方案
自动化测试·人工智能·ui·自动化·agent·skill·ai测试
远航计算机19 小时前
职业技能培训机构如何利用QClaw+Skills做豆包GEO:知识库搭建×内容创作×效果监测的完整实操手册
大数据·人工智能·自动化·aigc·火山引擎
qeen871 天前
【Linux】make/Makefile 自动化工具的介绍
linux·运维·服务器·自动化
HXDGCL1 天前
东莞市华创力科技:专业环形导轨工厂,助力自动化产线升级
运维·科技·自动化