【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()
相关推荐
东莞市壹星自动化设备有限公司16 小时前
透明圆瓶内部特征怎样定位:折射追踪与近远相位分支
嵌入式硬件·自动化·需求分析·几何学·骨骼绑定
BioTender17 小时前
Xaira 发布 X-Automate:将物理 AI 与智能体 AI 引入实验室自动化
运维·人工智能·自动化
其实防守也摸鱼1 天前
个人学习 Pwn 思路:从基础到漏洞利用的进阶路径
大数据·前端·人工智能·chrome·算法·安全·网络安全
天远API1 天前
零信任架构实战:基于天远运营商三要素详版V即时版构建自动化消费电子大促电商平台高价值权益秒杀与优惠券防羊毛高并发实名核验网关
运维·人工智能·架构·自动化
木头左2 天前
【Python】不点浏览器发博客:逆向 CSDN 创作中心接口做 md-publish 技能
python·自动化·api
lisw052 天前
智能化机器人系统的模块化设计自动化!
机器学习·机器人·自动化
天远Date Lab2 天前
零信任架构实战:基于天远租凭分期报告构建自动化汽车以租代购免押风控网关
网络·人工智能·架构·自动化
迪康Defender2 天前
终端供应链安全:应用白名单与软件正版化检测落地|终端安全治理实践
运维·服务器·网络·安全·web安全·自动化·运维开发
李长渊哦2 天前
Qoder 自定义子智能体(Subagent)学习笔记
chrome·笔记·学习
天远API3 天前
零信任架构实战:基于天远租凭分期报告构建自动化智慧租房免押分期履约评估网关
运维·人工智能·架构·自动化