diff --git a/src/Browser.php b/src/Browser.php index e3121f3e4..06509f4c5 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. *