If you are doing AJAX requests using jQuery, you can use this:
$driver->wait()->until(
function ($driver) {
return $driver->executeScript('return jQuery.active === 0;');
}
);
CLICK HERE to find out more related problems solutions.