Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Laravel Dusk: method that makes full-size screenshot in Chrome browser of failed tests
protected function captureFailuresFor($browsers)
{
$browsers->each(function (Browser $browser, $key) {
$body = $browser->driver->findElement(WebDriverBy::tagName('body'));
if (!empty($body)) {
$currentSize = $body->getSize();
$size = new WebDriverDimension($currentSize->getWidth(), $currentSize->getHeight());
$browser->driver->manage()->window()->setSize($size);
}
$browser->screenshot('failure-'.$this->getName().'-'.$key);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.