解决selenium+python 打开浏览器报错 DeprecationWarning executable_path has been deprecated, please pass in a Service object问题

报错如下:

解决方案:

直接上代码如下:

# -*- coding: utf-8 -*-
"""
@Time : 2022/10/24 16:03
@Auth : 软件测试君
@File :wait_demo.py
@IDE :PyCharm
@Motto:ABC(Always Be Coding)

"""
# selenium 4以上版本
import time

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://www.baidu.com/")

time.sleep(3)
print('当前页面标题:{0}'.format(driver.title))
posted @   久曲健  阅读(1783)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
历史上的今天:
2021-10-24 Vue3学习(八)之 Vue CLI多环境配置
2020-10-24 Pytest学习(四) - fixture的使用
2018-10-24 Jmeter之模拟文件上传、下载接口操作
点击右上角即可分享
微信分享提示