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:
$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.

Imported snapshots are listed under Local snapshots in the side rail, apart from the tests of a connected instance. The GUI needs no connection to open them.
The recorded DOM
With snapshots enabled, Puth records the DOM of each page and of every frame in it, also frames of other sites and frames in frames: a full copy when a document loads, then the changes, sent by the page at the start of every command. Selecting a step shows its page rebuilt from that recording, Before as it was when the step started and After as it was when the next step on the same page started. Unlike a screenshot this is exact, because it does not depend on when the browser painted. A step that acted on an element, like a click or typing, marks that element in both, and mouse actions also mark where they pressed.
The rebuilt page runs no scripts and loads nothing from the network: stylesheets, fonts and images are served from the recording, also when the application is gone, so an imported snapshot looks the same on any machine. Values in password fields and card number fields (autocomplete="cc-…") are masked before they leave the page, and so is every typed value in a frame whose origin differs from a page above it, like a payment form.
Web components are recorded with their open shadow roots and the stylesheets they adopt, and modal dialogs and open popovers show in the top layer as they did on the page.
Some content is not part of the recording and shows up empty or unstyled: <canvas> drawings, video frames, and closed shadow roots. A shadow root that an element other than a custom element attaches after it was recorded is only seen once something else about that element changes. Media queries follow the browser the GUI runs in. Record frames for such pages.
Recorded frames
Frames are the pictures Chrome paints. They are off by default; turn them on with the context option frames, or for a part of a test with enableFrames() and disableFrames(). A step then offers Frame next to DOM. In Laravel tests, use the PuthEnableFrames trait.
const context = await Context.create('http://127.0.0.1:7345', { snapshot: true, frames: true });
await context.disableFrames();Set dom to false to record no DOM.
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 test process; .puth snapshots are saved by the Puth server, which may run on a different machine.
