解决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))
优秀不够,你是否无可替代
软件测试交流QQ群:721256703,期待你的加入!!
欢迎关注我的微信公众号:软件测试君
![](https://www.cnblogs.com/images/cnblogs_com/longronglang/1061549/o_QQ%E6%88%AA%E5%9B%BE20190728134401.jpg)