python/selenium/chromedriver TimeoutException

python/selenium/chromedriver TimeoutException(python/selenium/chromedriver TimeoutException)

本文介绍了python/selenium/chromedriver TimeoutException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 selenium 和 chrome webdriver 从网站上抓取 pdf.我使用以下内容,从列表中拉出 site:

I'm in the process of scraping pdfs from a website using selenium and chrome webdriver. I use the following, pulling the site from a list:

driver.get(site) 
source = driver.page_source
...
...
driver.quit()

但我不断收到以下错误,我的 site 列表中有大约 6,000 次观察:

But I keep getting the following error, about 6,000 observations down my site list:

Traceback (most recent call last):
File "<stdin>", line 127, in <module>
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 323, in get self.execute(Command.GET, {'url': url})
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 311, in execute self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: timeout
(Session info: chrome=63.0.3239.84)
(Driver info: chromedriver=2.33.506092 
(733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.10.0-40-generic x86_64)

我尝试过以更短的时间间隔刷新源页面(每 200 次搜索,但我应该缩短吗?).

I've tried refreshing the source page at shorter intervals (every 200 searches, but should I go shorter?).

如何延长 selenium 的 120 秒超时限制?

How do I extend selenium's 120sec timeout limit?

推荐答案

这个错误信息...

Traceback (most recent call last):
File "<stdin>", line 127, in <module>
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 323, in get self.execute(Command.GET, {'url': url})
.
selenium.common.exceptions.TimeoutException: Message: timeout
(Session info: chrome=63.0.3239.84)
(Driver info: chromedriver=2.33.506092 
(733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.10.0-40-generic x86_64)

...表示 webdriver 实例无法与 site url 建立连接并发生 timeout.

...implies that the webdriver instance cannot establish a connection with the site url and timeout occurs.

您的主要问题是您使用的二进制文件之间的版本兼容性,如下所示:

Your main issue is the version compatibility between the binaries you are using as follows :

  • 您正在使用 ChromeDriver v2.33
  • ChromeDriver v2.33 明确提及以下内容:

支持 Chrome v60-62

  • 您正在使用 chrome=63.0
  • Selenium 版本我们不知道.
    • You are using chrome=63.0
    • Selenium Version is unknown to us.
    • 因此,您使用的 ChromeDriver v2.33Chrome 浏览器 v63.0 之间存在明显的不匹配.因此 ChromeDriver 无法生成新的 Chrome 浏览器 进程.

      So there is a clear mismatch between the ChromeDriver v2.33 and the Chrome Browser v63.0 you are using. Hence ChromeDriver is unable to spawn the new Chrome Browser process.

      • ChromeDriver 更新到最近的 v2.35 级别.
      • Chrome 升级到稳定的 Chrome v64.x 级别.(根据 ChromeDriver v2.35 发行说明)
      • Selenium 升级到当前级别 3.9.1 版.
      • 清理并通过您的IDE重新构建您的项目.
      • 清除浏览器缓存.
      • 运行 CCleaner 工具,在执行 之前和之后清除所有操作系统杂务测试套件.
      • 如果您的 Web 浏览器 基础版本太旧,请通过 Web 浏览器" rel="nofollow noreferrer">Revo Uninstaller 使用 Moderate Scan 并安装 Web 浏览器 的最新 GA 发布 版本.
      • 执行您的测试.
      • Update ChromeDriver to recent v2.35 level.
      • Upgrade Chrome to stable Chrome v64.x levels. (as per ChromeDriver v2.35 release notes)
      • Upgrade Selenium to current levels Version 3.9.1.
      • Clean and Re-Build your project through your IDE.
      • Clear the Browser Cache.
      • Run CCleaner tool to wipe off all the OS chores before and after execution of your Test Suite.
      • If your Web Browser base version is too old, uninstall the Web Browser through Revo Uninstaller with Moderate Scan and install a recent GA Released version of the Web Browser.
      • Execute your Tests.

      这篇关于python/selenium/chromedriver TimeoutException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:python/selenium/chromedriver TimeoutException

基础教程推荐