美文网首页
Selenium报错-selenium.common.excep

Selenium报错-selenium.common.excep

作者: 灰_太_狼 | 来源:发表于2021-08-28 14:38 被阅读0次

报错信息

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 89
Current browser version is 92.0.4515.159 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

在使用Selenium的过程中,经常会遇到浏览器版本号的报错,一般网上的解决方案有两种:

1.去Google官网下载Chrome浏览器的最新版本驱动,安装即可解决问题

2.禁掉Google浏览器的自动更新

但其实还有一种更方便的解决方案,可以通过webdriver-manager来解决

解决办法

导入头文件
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

使用
self.driver = webdriver.Chrome(ChromeDriverManager().install())

重新运行,即可解决。

相关文章

网友评论

      本文标题:Selenium报错-selenium.common.excep

      本文链接:https://www.haomeiwen.com/subject/skmbiltx.html