4 三种等待方式

1 隐式等待,作用域未 webdriver 生命周期内

driver.implicitly_wait(10)  # 隐性等待,最长等10秒

2 显示等待,

locator = (By.XPATH, "//*[@id='kw']") 
result
= WebDriverWait(self.driver, 10).until(expected_conditions.visibility_of_element_located(locator))

3 强制等待

time.sleep(3)  # 强制等待3秒再执行下一步

4 参考

  • https://www.jianshu.com/p/1531e12f8852
posted @ 2021-01-18 22:45  栗子测试开发  阅读(124)  评论(0)    收藏  举报