Skip to content
Examples and API calls for Laravel

Screenshots and debugging ​

Use a screenshot to capture a single view of the page. Use a Puth snapshot when you need the recorded commands, console output and errors as well.

Save a screenshot ​

Use Laravel's named screenshot wrapper:

php
$browser->screenshot('checkout', ['fullPage' => true]);

This writes tests/Browser/screenshots/checkout.png on the PHP test runner. For automatic failure screenshots and console logs, see Laravel test artifacts.

fullPage captures the whole scrollable page; omit it to capture the viewport. Screenshots are not supported on iframe-scoped browsers. $browser->fitContent() changes the viewport to fit the document, which can also change a responsive layout.

Replay a captured test ​

Open the local GUI at http://localhost:7345 and drop a .puth file into it to inspect the captured run. Step through commands and compare the viewport with the console output and errors.

See CI/CD and snapshots to save failed test snapshots and collect them as artifacts. In the examples above, screenshot files are saved by the PHP test process; .puth snapshots are saved by the Puth server, which may run on a different machine.