python - Robotframework: Clicking web-elemnt in loop often fails to find an element -


i have created keyword rf , selenium2library. supposed wait element clicking periodically on other element renew area element supposed appear. use example waiting mails in postbox.

the problem pretty "renew element" cannot found , clicked on loop iteration exists on screenshot. ideas why can happen?

def check_if_element_appeared(self, element_locator, renew_locator, renew_interval=10, wait_interval=300):             if not self.is_visible(renew_locator):         raise assertionerror("error message")     start_time=int(time())     scan_time = start_time     if not self.is_visible(element_locator):         while int(time())<=start_time+wait_interval:             if int(time()) >= scan_time + renew_interval:                 scan_time = int(time())                 self.click_element(renew_locator)                 if self.is_visible(element_locator):                     break         if not self.is_visible(element_locator):             raise assertionerror("error message")         self._info("message")     else:         self._info("current page contains element '%s'." % element_locator) 

shouldn't using keywords wait until page contains element or wait until element visible of selenium2library purpose:

*** test cases *** test case   prerequisite steps   wait until page contains element  ${locator}   succeeding steps 

edit: below python code might in pure robot syntax.

${iteration}=  evaluate  ${wait_interval} / ${renew_interval} :   ${i}  in range  0  ${iteration} \   click element   ${renew_locator} \   sleep  1 \   ${is_visible}=  run keyword , return status  element should visible  ${element_locator} \   exit loop if  ${is_visible} \   run keyword if  '${is_visible}' == 'false'  sleep  ${renew_interval} click element  ${element_locator} 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -