Prompt

How do I capture screenshots and videos during automated browser runs?

Technology / Testing & QA1 observationLast seen Oct 26, 2026

Latest observation

Oct 26, 2026OpenAI APIWeb search: off

You can capture screenshots and videos in automated browser runs in a few common ways, depending on the tool you’re using. Here are the main approaches and examples.

1) Playwright

Playwright has built-in support for both screenshots and video.

Screenshot

await page.screenshot({ path: 'screenshot.png', fullPage: true });

Video

Enable video when creating the browser context:

const context = await browser.newContext({
  recordVideo: { dir: 'videos/' }
});
const page = await context.newPage();

After the test/page finishes:

await page.close();
const videoPath = await page.video().path();

Notes

  • Video is saved when the page/context closes.
  • You typically set the video directory and then retrieve the file after the run.

2) Cypress

Cypress can take screenshots and record videos during test runs.

Screenshot

cy.screenshot('my-screenshot');

Video

Configure it in cypress.config.js:

module.exports = {
  video: true
};

Then run in headless mode:

npx cypress run

Notes

  • Video recording is mainly for cypress run, not interactive open mode.
  • Screenshots can be taken on demand or automatically on test failure.

3) Selenium

Selenium supports screenshots directly. Video usually requires external tooling.

Screenshot

In Java:

File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);

In Python:

driver.save_screenshot("screenshot.png")

Video

For video, common options include:

  • recording the screen with tools like ffmpeg
  • using a browser/grid service that provides session recordings
  • using Selenium Grid providers with built-in video capture

Example with ffmpeg:

ffmpeg -video_size 1366x768 -framerate 25 -f x11grab -i :0.0 output.mp4

4) Puppeteer

Puppeteer supports screenshots and screencast-style recording via Chrome DevTools Protocol, but not as directly as Playwright.

Screenshot

await page.screenshot({ path: 'screenshot.png', fullPage: true });

Video

Usually done through:

  • external screen recording tools
  • Chrome DevTools Protocol screencast frames
  • test runners/plugins that wrap recording

5) Practical tips

  • Capture screenshots on failure automatically.
  • Save files with timestamps or test names.
  • Store artifacts in CI so they’re easy to download.
  • If you need video, prefer frameworks with native support like Playwright or Cypress.

Example naming

const name = `artifacts/${testName}-${Date.now()}.png`;
await page.screenshot({ path: name });

If you tell me which framework you’re using—Playwright, Cypress, Selenium, Puppeteer, or something else—I can give you exact code for that setup.

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.