From 67beba7e7c0fbd5212d8615ecfdbf47515489ed2 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 17 Jun 2019 17:22:26 -0500 Subject: [PATCH 1/2] add option to fullsize the browser this will calculate the size of the `` and resize the browser to fit match it. --- src/Browser.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Browser.php b/src/Browser.php index e3121f3e4..f8f78fd3c 100644 --- a/src/Browser.php +++ b/src/Browser.php @@ -5,6 +5,7 @@ use Closure; use BadMethodCallException; use Illuminate\Support\Str; +use Facebook\WebDriver\WebDriverBy; use Facebook\WebDriver\WebDriverPoint; use Illuminate\Support\Traits\Macroable; use Facebook\WebDriver\WebDriverDimension; @@ -246,6 +247,22 @@ public function resize($width, $height) return $this; } + /** + * Make the browser window as large as the content. + * + * @return $this + */ + public function fullsize() + { + $body = $this->driver->findElement(WebDriverBy::tagName('body')); + + if (!empty($body)) { + $this->resize($body->getSize()->getWidth(), $body->getSize()->getHeight()); + } + + return $this; + } + /** * Move the browser window. * From a2c9a6ba94e9e30d39d31f6fa0387ce766d5f952 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 17 Jun 2019 17:25:38 -0500 Subject: [PATCH 2/2] formatting --- src/Browser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Browser.php b/src/Browser.php index f8f78fd3c..06509f4c5 100644 --- a/src/Browser.php +++ b/src/Browser.php @@ -256,7 +256,7 @@ public function fullsize() { $body = $this->driver->findElement(WebDriverBy::tagName('body')); - if (!empty($body)) { + if (! empty($body)) { $this->resize($body->getSize()->getWidth(), $body->getSize()->getHeight()); }