设置超时时间


from selenium import webdriver
driver=webdriver.Chrome()
driver.set_page_load_timeout(5)
driver.set_script_timeout(5)#这两种设置都进行才有效

 

测试后发现可用,超时就会提示错误

try:
    d.get(s)
except:
    d.execute_script('window.stop()')#这句话好像没什么软用

可以在页面停止加载后继续操作了

相关文章:

  • 2021-08-05
  • 2021-10-02
  • 2021-11-30
  • 2021-08-19
  • 2021-11-17
  • 2021-08-19
  • 2021-08-01
  • 2022-01-25
猜你喜欢
  • 2022-02-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2021-04-22
  • 2021-10-20
相关资源
相似解决方案