Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

How to work with jQuery AJAX

whhone edited this page · 2 revisions
$submitButton = $driver->findElement(WebDriverBy::id('Submit'));
$submitButton->click();
waitForAjax($driver);
$anotherButton = $driver->findElement(WebDriverBy::id('secondButton'));
  • Where waitForAjax method is defined as
  • Two methods are defined use one of these
function waitForAjax($driver)
{
    do {
        sleep(2);
    } while ($driver->executeScript('return jQuery.active'));
}
function waitForAjax($driver)
{
    // wait for at most 30s, retry every 2000ms (2s)
    $driver->wait(30, 2000)->until(
        function ($driver) {
            return !$driver->executeScript('return jQuery.active');
        }
    );
}

Original article/Other solutions http://agilesoftwaretesting.com/?p=111

Something went wrong with that request. Please try again.