linguosen

解决Chrome与chromedriver版本不一致的问题

今天使用selenium时遇到如下异常信息:

driver.get(\'https://www.baidu.com\')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\python3.7.3-install-path\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
self.execute(Command.GET, {\'url\': url})
File "D:\python3.7.3-install-path\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "D:\python3.7.3-install-path\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.executionContextCreated has invalid \'context\': {"auxData":{"frameId":"1902135EC45F5C7A8A0CD69740B466CA","isDefault":true,"type":"default"},"id":1,"name":"","origin":"://"}
(Session info: chrome=70.0.3538.102)
(Driver info: chromedriver=2.6.233026,platform=Windows NT 6.3 x86_64)

 

其原因就是Chrome与chromedriver版本不一致,解决方案:

异常信息中指出我chrome的版本是70.0.3538.102,而chromedriver版本是2.6.233026,明显版本不对应:

所以就需要去以下网址下载对应版本的chromedriver:

 http://npm.taobao.org/mirrors/chromedriver/

找到对应版本的chromedriver下载并放在对应python版本的Scripts文件夹下:

 

 

然后就可以正常驱动打开网页了:

 

如有错误,欢迎指正!

 

发表于 2019-05-11 01:56  林国森  阅读(12353)  评论(0编辑  收藏  举报
 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-10-27
猜你喜欢
  • 2021-12-02
  • 2021-04-18
  • 2021-12-12
  • 2021-11-29
  • 2021-12-02
相关资源
相似解决方案