views:

1561

answers:

2

[UPDATE 2: We rendered this question no longer relevant - using the -avoidProxy argument to the Selenium server meant Selenium-RC and our application worked together. So now we can use a programming language client driver to do the below. Thanks for the answers, though, they were helpful in pushing us to to this]

We have a web application that we can submit requests to. These requests can take a variable but sometimes long time to complete (minutes). Requests are submitted for specific devices that this application manages

We can tell the request has completed in two ways, by looking at an "activity log" page for a line that marks the job (whose ID we do know) as completed, or looking at the page for the specific device to see when the list of active jobs is empty.

Neither page autorefreshes or uses Ajax - we need to refresh the page, check the page for the content we want, refesh the page and so on.

Is there some idiom with Selenium to do this? We can try a sequence of refresh/check/refresh/check commands, but that's unreliable and (when the operation complete quickly) unnnecessarily time consuming.

UPDATE for info some answers make clear I've missed :(

We're using Selenium Core only with .hta. It's an IE only app (doesn't run in firefox at all) so no Selenium-IDE, and Selenium-RC breaks other pages of the application that use Ajax heavily (don't know why, or how to track down the problem)

(Also posted over at OpenQA, but I think there may be more Selenium users here)

+1  A: 

Are you using the IDE or the remote runner? If you generate a test in any language, can't you just modify it to run in a loop until it finds what you want. Should be a trivial task.

Sunny
Just core with .htsWe can't use Selenium-IDE becasue this is a IE-only application (won't run at all in Firefox) and Selenium-RC breaks other pages of the app that are heavily Ajax'd (I've no idea why, and no real idea on how to find out what the issue is)
Paul
+1  A: 

You can use Selenium.html.waitForCondition(String, String). You just write a little JavaScript function to check for the content and the method will return once the function returns true.

sblundy
We tried that but things sit in a constant refresh-as-fast-as-it-can loop, and that crashes IE in about 30 seconds. Is there some way of making that refresh only every 30 seconds or so?
Paul
You might be able to set the timeout to < 30 sec and put it in a loop with a sleep call to let IE recover...
sblundy
Right, but if I could put it in a loop I wouldn't have to ask the question :) Maybe I need to work out why Selenium-RC breaks our application...
Paul