We use Selenium to test smoke on the Java Spring MVC website. We invoke it using JUnit and the Java Selenium client. In most cases, our tests work fine, but we tend to get timeouts in selenium.waitForPageToLoad in obviously random places. (That is, run the test suite several times, and the location and number of timeouts will vary greatly.)
By running it with the server in the foreground, I can monitor the execution of the tests. When one of these timeouts occurs, selenium.click crashed before the wait, but the wait does not appear. Right-click on the page and select Refresh to clear the lock.
For me, this suggests a race condition between click and waitForPageToLoad. Other problems are related to waitForPageToLoad, but do not describe the state of the race. Some of them suggested problems with the previous call to selenium.click, but I do not see this here. Has anyone else seen what I watched?
I saw several suggestions not to use waitForPageToLoad, but workarounds often suggest using waitForElementPresent or manually polling for the presence of an element. With our application, which would seem to require HTML tools with identifiers that will be used only by tests. Is there a non-intrusive approach to this method?
source
share