Thursday, December 16, 2010

Automation-Selenium Ajax Application

For ajax applications waitForPageToLoad wouldn’t work since the page is not actually loaded to refresh the Ajax element. Instead of using Thread.sleep(xxx) we can wait for a specified period and then continue once we found the element.

waittime=10;
while(waittime!=0){
try { if (selenium.isElementPresent("webelement")) break; } catch (Exception e) {}
Thread.sleep(1000);
waittime--;
}



No comments: