Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
/*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);
//pass in our closure
echo 'loop...';
//Wait for jQuery to be done processing ajax request
$result = (0 === count($driver->executeScript("return == 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.