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

文章讲述了在更新到Selenium4.11版本后,由于对`executeable_path`参数的支持被移除,开发者需将代码中的ChromeDriver路径改为使用`Service`参数。示例代码展示了如何修改为新的ChromeOptions设置方式。
摘要由CSDN通过智能技术生成

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)

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值