目录
# 1. 错误描述
# 2. 错误原因
出现 DeprecationWarning 警告的类型错误:该类型的警告大多属于版本更新时,所使用的方法过时的原因,他在当前版本被重构,还可以传入参数,但是在之后的某个版本会被删除.
查询当前版本重构后的函数,是之前的 executable_path 被重构到了 Service 函数里,如图
# 3. 解决方案
# -*- coding = utf-8 -*-
# @Time : 2021/10/16 17:47
# @Author : LIUYU
# @File : test_selenium.py
# @Software : PyCharm
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
s = Service(r"D:Softwarewebdriverschromedriver.exe")
driver = webdriver.Chrome(service=s)
driver.get('https://www.baidu.com')
driver.close()