From 431347f5d6dabf9b90fb27caed5fa51a06e6d9cf Mon Sep 17 00:00:00 2001 From: Adel Vilkov Date: Mon, 10 Feb 2020 16:16:29 +0300 Subject: [PATCH] Size sanity check at fitContent (fixes #729) --- src/Browser.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Browser.php b/src/Browser.php index c8327dc97..645ea779f 100644 --- a/src/Browser.php +++ b/src/Browser.php @@ -273,6 +273,9 @@ public function fitContent() $html = $this->driver->findElement(WebDriverBy::tagName('html')); if (! empty($html)) { + if ($html->getSize()->getWidth() <= 0 || $html->getSize()->getHeight() <= 0) { + return $this; + } $this->resize($html->getSize()->getWidth(), $html->getSize()->getHeight()); }