学习笔记python-selenium WebDriverWait

上一篇 / 下一篇  2017-03-17 16:43:37 / 个人分类:selenium

需要用到的包:
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions
格式:
WebDriverWait(driver,timeout,poll_frequency).until()后面可以还加.click()等
timeout 等待的总时间,poll_frequency 间隔多长时间执行一次until中的方法,默认0.5s
until中可以用lambda、excepted_conditions等

excepted_conditions中包括
title_is(object)  object为title名
title_contains(object)  object为title名包含的内容
presence_of_element_located(object)  object是一个locater
visibility_of_element_located(object)  object是一个locater
visibility_of(object)  object是一个元素
prence_of_all_elements_located(object)  object是一个locater
text_to_be_present_in_element(object)  object是文本
text_to_be_present_in_element_value(object)  object是文本
frame_to_be_available_and_switch_to_it(object)  object是locater
invisibility_of_element_located(object)  object是locater
element_to_be_clickable(object)  object是一个locater
staleness_of(object)  到时间结束为止,元素不再接入dom,返回元素本身;否则返回false。 object是element
element_to_be_selected(object)  object是一个element
element_located_to_be_selected(object)  object是个locater
element_selection_state_to_be(object)  检查给定的元素是否被选定,object为:element是WebElement,is_selected是个boolean
element_located_selection_state_to_be(object)  同上,element变为locator,locator
alert_is_present(object)  
注:locater是个元组(by,path)

WebDriverWait(driver,timeout,poll_frequency).until_not()
同上

TAG:

 

评分:0

我来说两句

日历

« 2024-04-21  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 7407
  • 日志数: 6
  • 建立时间: 2017-03-17
  • 更新时间: 2017-08-01

RSS订阅

Open Toolbar