【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()
相关推荐
阿童木写作13 小时前
Python实现Temu图片批量翻译自动化教程
运维·人工智能·python·自动化
iori97king14 小时前
库存不足自动通知:第一次使用自动化
运维·自动化
EAIReport17 小时前
工业电气自动化数据治理破局:多Agent大模型赋能全景智能决策
大数据·运维·自动化
腾讯蓝鲸智云17 小时前
标杆客户实践提炼:CFlow 版本价值流模板实战指南
运维·服务器·自动化·云计算·devops
Yang961119 小时前
自动化射频测试台快速搭建,鼎讯信通 DXSL 矢量信号源模块二次开发集成指南
运维·自动化
做一个AK梦19 小时前
GitHub Actions 自动化运维实战
自动化
海兰20 小时前
【思考】RPA(机器人流程自动化)+AI
机器人·自动化·rpa
电化学仪器白超21 小时前
禹衡光栅长度计精度评测:基于国标0级氧化锆量块的校正与数据分析
python·单片机·嵌入式硬件·物联网·自动化
nbzy8881 天前
设备铭牌与文本资料的生产能力证据提取:以储能压铸零部件为例的OCR与规则校验实现
自动化·内容生成·储能压铸零部件
HAHAXX81 天前
ChatGPT 4o + RPA 自动化工具:一站式业务流程开发实战指南
chatgpt·自动化·rpa