DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(executable_path='chromedriver.exe')
出现 DeprecationWarning 警告的类型错误:该类型的警告大多属于版本已经更新,所使用的方法过时。
查询当前版本重构后的函数,是之前的 executable_path 被重构到了 Service 函数里
文章来源:https://www.toymoban.com/news/detail-568376.html
尝试解决方法:文章来源地址https://www.toymoban.com/news/detail-568376.html
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
# 尝试传参
s = Service("chromedriver.exe")
driver = webdriver.Chrome(service=s)
driver.get('https://www.baidu.com/')
driver.quit()
到了这里,关于selenium 报错 DeprecationWarning: executable_path has been deprecated, please pass in a Service object的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!