TypeError: WebDriver.__init__() got multiple values for argument ‘options‘

selenium调用chromedriver报错,之前是可以用的,今天升级了一下selenium=4.11,搜了一下原来是selenium4.10开始不支持executeable_path参数了,需要使用service参数代替

相关代码需要修改为:

from selenium.webdriver.chrome.service import Service

chromedriver_path = "{}chromedriver.exe".format(os.path.dirname(os.path.abspath(__file__)))  #指定chromedriver路径
chrome_options = webdriver.ChromeOptions()
driver=webdriver.Chrome(service=Service(chromedriver_path), options=chrome_options)

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>