/**
* Continuously poll the page, until you find an element
* with the given name or id.
*
* @param string $element
* @param integer $timeout
* @return static
*/
public function waitForElement($element, $timeout = 5000)
{
$this->session->timeouts()->postImplicit_wait(['ms' => $timeout]);
try {
$this->findByNameOrId($element);
} catch (InvalidArgumentException $e) {
throw new InvalidArgumentException("Hey, what's happening... Look, I waited {$timeout} milliseconds to see an element with " . "a name or id of '{$element}', but no luck. \nIf you could take a look, that'd be greaaattt...");
}
return $this;
}