python+selenium六:隐式等待

Posted 怪圣卡杰

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python+selenium六:隐式等待相关的知识,希望对你有一定的参考价值。

python+selenium六:隐式等待

 
# 隐式等待


# 全局生效,只写一次即可(仅当前页面)
# 若有页面切换,需sleep等待新页面出现后,再使用此方法


# 如:在35秒内,等待操作完成,完成后,不再等待
# driver.implicitly_wait(35)

from selenium import webdriver
import time
driver = webdriver.Firefox()
time.sleep(3)
driver.get("https://www.baidu.com")

# 隐式等待30秒:等待页面加载完成
driver.implicitly_wait(30)
print(driver.title)

 



# 缺点:如果页面一直转圈,如:js出错将等待到所设置的时间完成

以上是关于python+selenium六:隐式等待的主要内容,如果未能解决你的问题,请参考以下文章

转 Python selenium 强制等待显示等待隐式等待

selenium中的三种等待方式(显示等待WebDriverWait()隐式等待implicitly()强制等待sleep())---基于python

七Appium-python-UI自动化之强制等待:sleep,隐式等待:implicitly_wait,显示等待:WebDriverWait()

selenium python 显式和隐式等待方法

Python+Selenium笔记:元素等待机制

selenium 显示等待和隐式等待哪个更好