Хорошая идея.
Попробуем с нуля.
Есть элементарный тест, унаследованный от SeleneseTestCase. Вроде бы все делаю как Вы пишете. Но не компилится, не видит метода waitForAjaxRequests.
public class OptionsTest extends SeleneseTestCase {
@Before
public void setUp() {
selenium = new CustomSelenium("localhost", 4444, "*chrome C:\\Program Files\\Mozilla Firefox_3\\firefox.exe","http://genesis1.etnasoft.com/gen_otp_test");
selenium.setExtensionJs(
"Selenium.prototype.isJqueryUsed = function() {return typeof(this.browserbot.getUserWindow().jQuery) == 'function';};"+
"Selenium.prototype.isPrototypeUsed = function() {return typeof(this.browserbot.getUserWindow().Ajax) == 'function';};"+
"Selenium.prototype.isDojoUsed = function() {return typeof(this.browserbot.getUserWindow().dojo) == 'function';};"+
"Selenium.prototype.doWaitForAjaxRequests = function(timeout) {"+
"if (this.isJqueryUsed()) {"+
"return this.doWaitForJqueryAjaxRequests(timeout);"+
"}"+
"if (this.isPrototypeUsed()) {"+
"return this.doWaitForPrototypeAjaxRequests(timeout);"+
" }"+
"if (this.isDojoUsed()) {"+
"return this.doWaitForDojoAjaxRequests(timeout);"+
"}"+
"};"+
"Selenium.prototype.doWaitForJqueryAjaxRequests = function(timeout) {"+
"return Selenium.decorateFunctionWithTimeout(function() {"+
"return selenium.browserbot.getUserWindow().jQuery.active == 0;"+
"}, timeout);"+
"};"+
"Selenium.prototype.doWaitForPrototypeAjaxRequests = function(timeout) {"+
"return Selenium.decorateFunctionWithTimeout(function() {"+
"return selenium.browserbot.getUserWindow().Ajax.activeRequestCount == 0;"+
"}, timeout);"+
"};"+
"Selenium.prototype.doWaitForDojoAjaxRequests = function(timeout) {"+
"return Selenium.decorateFunctionWithTimeout(function() {"+
"return selenium.browserbot.getUserWindow().dojo.io.XMLHTTPTransport.inFlight.length == 0;"+
"}, timeout);"+
"};"
);
selenium.start();
}
@After
public void tearDown() {
selenium.stop();
}
@Test(expected=com.thoughtworks.selenium.Wait.WaitTimedOutException.class)
public void test() throws InterruptedException, ParseException {
selenium.setContext("test()");
selenium.open("http://genesis1.etnasoft.com/gen_otp_test");
selenium.waitForAjaxRequests(20000);
selenium.waitForPageToLoad("3000");
}