From 862f3439a2d948f794acc965fb198876750fb9ac Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 27 Jan 2020 10:40:49 -0600 Subject: [PATCH] fit content to `` instead of `` most browsers apply a margin of 8px to the `` tag automatically. it's very common for most CSS frameworks to "normalize" this to zero, which is why for most people the size and the size are the same. since it's not the case for everyone, we can use the size here instead. --- src/Browser.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Browser.php b/src/Browser.php index dc9ed175d..c8327dc97 100644 --- a/src/Browser.php +++ b/src/Browser.php @@ -270,10 +270,10 @@ public function fitContent() { $this->driver->switchTo()->defaultContent(); - $body = $this->driver->findElement(WebDriverBy::tagName('body')); + $html = $this->driver->findElement(WebDriverBy::tagName('html')); - if (! empty($body)) { - $this->resize($body->getSize()->getWidth(), $body->getSize()->getHeight()); + if (! empty($html)) { + $this->resize($html->getSize()->getWidth(), $html->getSize()->getHeight()); } return $this;