此版本的ChromeDriver仅支持Chrome版本78

时间:2019-09-29 21:03:11

标签: web-scraping selenium-chromedriver

我想从Glassdoor进行网页抓取。然后从https://github.com/MatthewChatham/glassdoor-review-scraper

中找到一个包

我下载了版本为78.0.3904.11的chromedriver。但是当我运行python文件时,它总是说:

2019-09-29 15:57:25,182 INFO 363    :main2.py(10991) - Configuring browser
Traceback (most recent call last):
  File "main2.py", line 397, in <module>
    browser = get_browser()
  File "main2.py", line 368, in get_browser
    browser = wd.Chrome(options=chrome_options)
  File "/usr/local/var/pyenv/versions/anaconda3-2019.03/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/var/pyenv/versions/anaconda3-2019.03/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/var/pyenv/versions/anaconda3-2019.03/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/var/pyenv/versions/anaconda3-2019.03/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/var/pyenv/versions/anaconda3-2019.03/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 78

我不知道为什么...

1 个答案:

答案 0 :(得分:0)

主要版本的chromedriver和您的Chrome浏览器需要完全匹配。因此,对于Chrome 77,应使用chromedriver 77,对于Chrome 78,应使用chromedriver78。如果版本不匹配,则需要下载与网络浏览器的主要版本匹配的chromedriver版本。

要检查版本,请执行以下操作:

  • Chrome浏览器:

      在网址栏中
    • 在网址栏中输入“ chrome:// version /”
    • 以“ Google Chrome:”开头的第一行应显示您浏览器的版本
  • chromedriver:

    • 打开命令行
    • 将您的工作目录更改为包含chromedriver的目录
    • 键入'./chromedriver -v'以打印其版本