Prompt
Browser script monitoring with screenshots
Latest observation
Oct 27, 2026
OpenAI APIWeb search: off
If you want to monitor a browser script and capture screenshots, there are a few common approaches depending on what you mean by “browser script”:
1) Run the script in a browser automation tool
Use something like:
- Playwright
- Puppeteer
- Selenium
These let you:
- launch a browser
- run your script
- take screenshots at key moments
- log console/errors/network activity
Example with Playwright (Node.js)
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
page.on('console', msg => console.log('Console:', msg.text()));
page.on('pageerror', err => console.error('Page error:', err));
await page.goto('https://example.com');
await page.screenshot({ path: 'page.png', fullPage: true });
await browser.close();
})();
2) Continuous monitoring with screenshots
If you need ongoing monitoring:
- take screenshots on a schedule
- compare images over time
- alert on visual changes or errors
Tools:
- Playwright + cron/job scheduler
- Selenium Grid
- Visual regression tools like Percy, Applitools, Argos
3) Capture screenshots of a running browser tab
If you mean monitoring a user’s active browser:
- browser extensions can capture tabs/screenshots
- remote debugging tools can attach to Chrome and capture a page
- note: permissions and privacy matter here
4) Browser script debugging/observability
To monitor what the script is doing, capture:
- console logs
- exceptions
- network requests/responses
- screenshots on failure
- DOM snapshots
Example screenshot on failure
try {
await page.click('#submit');
} catch (e) {
await page.screenshot({ path: 'error.png', fullPage: true });
throw e;
}
5) Headful monitoring
If you want to visually watch it:
- run the browser non-headless
- use
slowMoin Playwright/Puppeteer to slow actions down - record video as well as screenshots
Example:
const browser = await chromium.launch({ headless: false, slowMo: 200 });
If you want, I can give you a ready-to-run script for:
- Playwright
- Puppeteer
- Selenium
and tailor it to:
- a specific website
- scheduled monitoring
- screenshot on error
- visual change detection