views:

57

answers:

2

Is it possible in selenium to write blocking commands?

I want to make a "clickAndWaitForAjax" command. It will click a button and wait until a div is filled with text from the server.

It is clear to me this can be done with two commands, but can it be done with one? How?

+3  A: 

If you write your scripts as JUnit tests, then it's all just Java code. You can easily write a single method that calls one, two, or a whole lot of different selenium methods. Or you could use your favourite language and testing framework.

This makes it much easier for testing complex systems.

See Selenium RC documentation for details.

John
+4  A: 

The best practise for this is to wait for elements on the page to be in the div. You can use a number of different commands like waitForElementPresent, waitForElementVisible,etc or you can write some JavaScript to check if the element in the DOM and use waitForCondition.

These are standard Selenium commands and can be ported to a programming language of your choice if you wish to run your tests running Selenium RC

AutomatedTester