webdriver.get() raise TimeoutException



我每天将硒与芹菜和mitmproxy结合使用,以扫描来自多个网站的cookie。 昨天我的应用程序由于以下异常而崩溃:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/celery/app/trace.py", line 385, in trace_task
R = retval = fun(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/celery/app/trace.py", line 648, in __protected_call__
return self.run(*args, **kwargs)
File "/home/myapplication/myapplication/api/tasks.py", line 24, in scan_periodically
x.startscanner(executor=Scan.PERIODICALLY)
File "/home/myapplication/myapplication/api/scanner.py", line 204, in startscanner
self.browser_list[self.browser_list_place].get(self.website.url)
File "/home/myapplication/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "/home/myapplication/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/myapplication/.local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: timeout
(Session info: headless chrome=76.0.3809.100)

我使用来自Selenium的python api与python版本3.7.3,selenium api版本3.141.0和Google Chrome 76.0.3809.100与chromedriver版本76.0.3809.68

。为什么 webdriver get(( 方法会引发 TimeoutException?

尝试这个参数来避免/覆盖超时,我在我的硒库上找到了它们

import socket
from selenium.common.exceptions import TimeoutException
#Init your browser, then
#...
socket.setdefaulttimeout(int(60))
your_browser_driver.set_page_load_timeout(60)

相关内容

  • 没有找到相关文章

最新更新