Prompt

How do I get screenshots and videos from failed browser tests?

Technology / Testing & QA1 observationLast seen Oct 27, 2026

Latest observation

Oct 27, 2026OpenAI APIWeb search: off

To capture screenshots and videos from failed browser tests, you usually need two things:

  1. Enable screenshot/video recording in your test runner or browser automation tool
  2. Configure it to save artifacts when a test fails

The exact setup depends on the tool you’re using. Here are the most common approaches:


Playwright

Playwright makes this pretty easy.

Screenshots on failure

import { test } from '@playwright/test';

test('example', async ({ page }) => {
  await page.goto('https://example.com');
  // test steps...
});

In playwright.config.ts:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    screenshot: 'only-on-failure',
    video: 'retain-on-failure',
  },
});

What this does

  • screenshot: 'only-on-failure' saves screenshots only when a test fails
  • video: 'retain-on-failure' keeps video only for failed tests

Artifacts are usually stored in the test output folder and can be viewed in the HTML report.


Cypress

Cypress can automatically capture screenshots and videos.

Screenshots

Cypress takes screenshots on failure by default if configured properly.

Videos

Video recording is enabled in cypress.config.js:

const { defineConfig } = require('cypress');

module.exports = defineConfig({
  video: true,
  screenshotOnRunFailure: true,
});

Notes

  • Videos are recorded for test runs in cypress run
  • Screenshots on failure are saved automatically
  • You can customize output folders

Selenium / WebDriver

Selenium doesn’t record video by itself, but you can:

Take screenshots on failure

Example in Java:

if (testFailed) {
    File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
    // save file to disk
}

Record video

For video, you typically need:

  • a grid service that supports recording, such as Selenium Grid, BrowserStack, Sauce Labs, or Selenoid
  • or use a separate screen-recording tool/container setup

BrowserStack / Sauce Labs / cloud testing services

These usually provide:

  • automatic screenshots
  • session video recordings
  • logs and console output

You generally just need to:

  • enable video in the service config
  • mark artifacts to keep on failure
  • inspect the dashboard after the run

General pattern for any test framework

If you’re building this yourself, the logic is:

  1. Before each test

    • start browser
    • initialize screenshot/video recording if needed
  2. On test failure

    • capture current screenshot
    • stop recording and save video
    • attach files to test report
  3. On test success

    • optionally delete artifacts to save space

Best practices

  • Save artifacts with test name + timestamp
  • Keep only failed-test videos to reduce storage
  • Attach artifact links in CI reports
  • Preserve browser console logs alongside screenshots/videos

If you tell me which framework you’re using — Playwright, Cypress, Selenium, Puppeteer, WebdriverIO, etc. — I can give you the exact config and code.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.