Closed spooning closed 9 years ago
Originally submitted to Google Code by @pekkaklarck on 10 Jan 2012
1) Wait Until Page Contains Element uses Selenium's is_present method. We cannot do much if it doesn't always work correctly. Could you test this with the latest SeleniumLibrary version? It could be that a possible Selenium bug has been fixed. If the problem still persists, I recommend you to search is this a know Selenium problem. You could also try Selenium alone (e.g. Selenium IDE) to test this.
2) Why should we use pause provided by Selenium when we can use Python's time.sleep? Notice also that time.sleep(0.2) sleeps 0.2s.
Library version: SeleniumLibrary2.5.7, Python2.6, Jython2.5.2 windows XP OS
__Question1 we use the keyword "wait until page contains element" in testcase and run it. But sometimes the keyword works and sometimes not. Is it a bug pls? ---Error Message: Element 'selectWin_Frame' did not appear in 1 minute in fact, the element "selectWin_Frame" has appeard for tens secondes. ---testcase code: ...... wait until page contains element selectWin_Frame select frame selectWin_Frame ..... __Question2 Why not use self.do_command("pause", "2s") to replace time.sleep(0.2) ?
def _wait_until(self, timeout, error, function, _args): timeout = self._get_timeout(timeout) error = error.replace('<TIMEOUT>', utils.secs_to_timestr(timeout)) maxtime = time.time() + timeout while not function(_args): if time.time() > maxtime: raise AssertionError(error) time.sleep(0.2)