我想爬取某网页,该网页加载速度特别慢,所以设置超时时间强制加载
driver.set_page_load_timeout(3)
try:
driver.get('链接')
except TimeoutException:
driver.execute_script('window.stop()')#超时后停止加载
然后报错,后面的代码都无法执行了
报错信息如下
selenium.common.exceptions.TimeoutException: Message:Timeout