Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.0] add option to fullsize the browser #655

Merged
merged 2 commits into from
Jun 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down