码迷,mamicode.com
首页 > Web开发 > 详细

WebDriverWait

时间:2014-09-27 16:36:50      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:io   ar   sp   on   c   r   ef   bs   res   

WebDriverWait(self, driver, timeout).until(self, method,message=‘ ‘)

def until(self, method, message=‘‘):
"""Calls the method provided with the driver as an argument until the \
return value is not False."""
end_time = time.time() + self._timeout
while(True):
try:
value = method(self._driver)
if value:
return value
except self._ignored_exceptions:
pass
time.sleep(self._poll)
if(time.time() > end_time):
break
raise TimeoutException(message)

 

WebDriverWait(driver, 10).until(lambda s: not self.is_element_present((By.ID, ‘delete-me’)))

WebDriverWait

标签:io   ar   sp   on   c   r   ef   bs   res   

原文地址:http://www.cnblogs.com/cfeng/p/3996363.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!