S.Roshanth
S.Roshanth

Reputation: 1507

Automate Ajax Applications with Selenium

I am trying to automate an Ajax application using Selenium WebDriver. Selenese commands mention in the selenium documents not working well with the application. Is there any better approach or commands to deal with Ajax applications? Any help/guidance is appreciated.

Upvotes: 0

Views: 955

Answers (1)

Gaurav
Gaurav

Reputation: 83

Important thing about Ajax applications is whether Jquery is active or not. If it is active then script need to wait for it. You can handle it with following code.

while (true) // Handle the timeout
    {
        boolean ajaxIsComplete = (boolean)((JavascriptExecutor) wbDv).executeScript("return jQuery.active == 0");
        if (ajaxIsComplete)
            break;
        Thread.sleep(1000);
    }

Tell me if it is helpful or not.
Thanks

Upvotes: 1

Related Questions