Selenium: how to refresh a page over and over until it contains certain content?

[UPDATE 2: We made this question more obsolete - using the -avoidProxy argument for the Selenium server meant that Selenium-RC and our application worked together. So now we can use the programming language client driver to do the following. Thanks for the answers, but they were helpful in getting us to do this]

We have a web application that we can send requests to. These requests can take a variable, but sometimes for a long time (minutes). Requests are sent for specific devices that this app controls

We can say that the request has completed in two ways: by looking at the Activity Log page for the line that marks the job (whose ID we know) completed, or by viewing the page for a specific device, see when the list of active jobs is empty.

No page automatically refreshes or uses Ajax - we need to refresh the page, check the page for the content we want, refresh the page, etc.

Is there some idiom with Selene? We can try the refresh / check / refresh / check sequence of commands, but this is unreliable and (when the operation completes quickly) unnecessarily takes a long time.

UPDATE for info some answers clearly I missed :(

We only use Selenium Core with .hta. This app is IE only (doesn't work in firefox at all), so there is no Selenium-IDE, and Selenium-RC breaks other pages of the app that heavily use Ajax (don't know why, or how to track down the problem)

(Also posted on OpenQA, but I think there might be more Selenium users here)

0


source to share


2 answers


Are you using an IDE or a remote runner? If you are creating a test in any language, can you just change it to run in a loop until it finds what you want. Should be a trivial task.



+1


source


You can use Selenium.html.waitForCondition(String, String)

. You just write a small JavaScript function to check the content and the method will return after the function returns true

.



+1


source







All Articles