MuraliKola / robotframework-seleniumlibrary

Automatically exported from code.google.com/p/robotframework-seleniumlibrary
Apache License 2.0
1 stars 0 forks source link

The keyword "wait until page contains element" does not always work! #222

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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)

Original issue reported on code.google.com by scottyan...@gmail.com on 28 Dec 2011 at 7:51

GoogleCodeExporter commented 8 years ago
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.

Original comment by pekka.klarck on 10 Jan 2012 at 9:54