public function waitForElementUntilTextIsChanged($targetText, $timeOutSeconds = 5) { $wait = true; while ($wait) { $currentText = $this->getText(); if ($currentText == $targetText) { $wait = false; } else { if ($timeOutSeconds <= 0) { throw new Exceptions\WebDriverWaitTimeout("Timeout for waitForElementUntilTextIsChange."); } } sleep(1); $timeOutSeconds = $timeOutSeconds - 1; } return $this; }