Python 2.7 Selenium,如何不等待页面加载
Python 2.7 Selenium, How to NOT wait for a page to load
如何不等待整个页面加载?有一个页面加载速度非常慢(完全加载该网页至少需要 3.5 分钟),我不想等这么久。
是否有可能在 driver.get("slowwebpage.com")
之后 selenium 不会等待网页加载而是等待一个元素让我们说:driver.find_element_by_id("element")
是 clickable/visible?
设置页面加载超时并捕获异常。
from selenium.common.exceptions import TimeoutException
try:
driver.set_page_load_timeout(seconds)
except TimeoutException:
pass
如何不等待整个页面加载?有一个页面加载速度非常慢(完全加载该网页至少需要 3.5 分钟),我不想等这么久。
是否有可能在 driver.get("slowwebpage.com")
之后 selenium 不会等待网页加载而是等待一个元素让我们说:driver.find_element_by_id("element")
是 clickable/visible?
设置页面加载超时并捕获异常。
from selenium.common.exceptions import TimeoutException
try:
driver.set_page_load_timeout(seconds)
except TimeoutException:
pass