Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/*before this is all your code that is doing things to the browser and perhaps submitting some data via ajax*/
//Lets make the webdriver wait for the ajax call
$webdriverWait = new WebDriverWait($driver, 10);
$webdriverWait->until(
//pass in our closure
function($driver)
{
echo 'loop...';
try
{
//Wait for jQuery to be done processing ajax request
$result = (0 === count($driver->executeScript("return jQuery.active == 0")));
}
catch (\Exception $ex) {
//catch an exception when execScript is called when an alert box is open.
//the Facebook driver will automatically handle closing the alert box
//return true so we can break out of the loop, and
$result = true;
}
return $result;
}
);
/*continue with your script*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.