赞
踩
DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(executable_path='chromedriver.exe')
出现 DeprecationWarning 警告的类型错误:该类型的警告大多属于版本已经更新,所使用的方法过时。
查询当前版本重构后的函数,是之前的 executable_path 被重构到了 Service 函数里
尝试解决方法:
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()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。