diff --git a/src/Page.php b/src/Page.php index 1192258..116b6eb 100644 --- a/src/Page.php +++ b/src/Page.php @@ -940,16 +940,9 @@ public function setHtml(string $html, int $timeout = 3000, string $eventName = s */ public function getHtml(?int $timeout = null): string { - try { - return $this->evaluate('document.documentElement.outerHTML')->getReturnValue($timeout); - } catch (JavascriptException $e) { - if (0 === \strpos($e->getMessage(), 'Error during javascript evaluation: TypeError: Cannot read properties of null (reading \'outerHTML\')')) { - \usleep(1000); + $this->getSession()->getConnection()->processAllEvents(); - return $this->evaluate('document.documentElement.outerHTML')->getReturnValue($timeout); - } - throw $e; - } + return $this->evaluate('document.documentElement.outerHTML')->getReturnValue($timeout); } /**