【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()
相关推荐
简离1 天前
前端调试实战:基于 chrome://webrtc-internals/ 高效排查WebRTC问题
前端·chrome·webrtc
金智维科技官方2 天前
智能体,重构企业自动化未来
人工智能·自动化·agent·智能体·数字员工
梦想的旅途22 天前
企业微信API:外部群自动化推送实战指南
大数据·机器人·自动化·企业微信·rpa
xiaoginshuo2 天前
流程自动化从传统RPA升级到AI Agent,如何匹配合适的自动化方案
人工智能·自动化·rpa
W-琑2 天前
软件测试-自动化测试
功能测试·自动化
牛奶咖啡132 天前
DevOps自动化运维实践_使用再生龙对Linux系统进行备份还原
运维·自动化·devops·linux系统的备份还原·linux系统克隆备份·再生龙
Youngchatgpt2 天前
如何在 Excel 中使用 ChatGPT:自动化任务和编写公式
人工智能·chatgpt·自动化·excel
GAOJ_K2 天前
同步带模组稳定运行的关键
人工智能·科技·自动化·制造
电化学仪器白超2 天前
EC20CEHDLG-128-SNNS调试记录
python·单片机·嵌入式硬件·自动化
Ai老司机2 天前
Chrome浏览器驱动(ChromeDriver)官方下载 - 全平台高速镜像站 | chromedrive.cn
前端·chrome