timeout
$ python3
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> browser = webdriver.Firefox()
>>> browser.get('http://xxx.xxx.xxx')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/test/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "/home/test/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/test/.local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: TimedPromise timed out after 300000 ms
set_page_load_timeout
from selenium import webdriver
browser = webdriver.Firefox()
browser.set_page_load_timeout(10)
browser.get('http://xxx.xxx.xxx')
browser.quit()
Reference
留言
張貼留言