1 python selenium google-chrome selenium-chromedriver selenium-webdriver
这是代码:
driver = webdriver.Chrome()
while True:
   #do thing that require hours
   #then i use selenium once
driver.get(link)
Run Code Online (Sandbox Code Playgroud)
我需要先打开硒,然后制作需要几个小时的东西,因为当我打开硒时,我需要做好准备并加快速度。如果放在driver = webdriver.Chrome()while 之下,它会减慢一切,我不知道它是否相关,但我用nohup命令运行此代码。
追溯:
Traceback (most recent call last):
  File "Scraper.py", line 84, in <module>
    main()
  File "Scraper.py", line 74, in main
    waitForSomething()
  File "Scraper.py", line 54, in waitForSomething
    fillForm(str(link)[2:-2])
  File "Scraper.py", line 30, in fillForm
    driver.get(link)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_resp$
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
  (Session info: chrome=192.168.0.0)
  (Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 4.9.0-9-amd64 x$
Run Code Online (Sandbox Code Playgroud)
    最初,我问自己与 @GregBurghardt 在评论中提出的问题相同的问题,直到我分析了详细的错误堆栈跟踪。
是的,在标记为 的步骤中发生了一些令人惊奇的事情#do thing that require hours。因此,不再将Chrome浏览器版本显示为chrome=76.0,chrome=75.0或者chrome=74.0显示:
(Session info: chrome=192.168.0.0)
Run Code Online (Sandbox Code Playgroud)
这非常令人惊讶。
除非您向我们更新Chrome版本更改为这样的值的原因和方式,否则几乎不可能分析该问题。
话虽如此,您的主要问题可能是您正在使用的二进制文件版本之间的不兼容。
支持Chrome v63-65
支持Chrome 版本 76
因此ChromeDriver v2.36和Chrome 浏览器 v76.0之间存在明显的不匹配
确保这件事:
@Test以非 root用户身份执行。driver.quit()始终在方法内调用tearDown(){}以优雅地关闭和销毁WebDriver和Web Client实例。|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           9614 次  |  
        
|   最近记录:  |