DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk5 min

How to Use an AI Agent to Screenshot a Webpage with a Custom User Agent

Configure the User-Agent before navigation, choose viewport, element, or full-page capture, then pass the image to the agent through its browser integration.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set the custom User-Agent on the browser session before it opens the page, then navigate and capture the page with that browser’s screenshot API. With Playwright, configure userAgent on a browser context; with Puppeteer, call page.setUserAgent() before navigation. An AI agent can use this workflow only if its browser-control tool exposes those settings—or if it can run the automation code—and the resulting image must be passed to the model by the agent integration.

What the custom User-Agent does—and what it does not

A User-Agent string tells a site which browser identity to present for the request. It can help you inspect how a site responds to a different browser identity, but it is only one part of a browser or device profile. Viewport, screen size, touch support and other emulated properties are separate settings; changing the string alone does not make a desktop browser equivalent to a physical phone. Playwright documents the User-Agent override and other emulation properties separately in its emulation guide.

As an Amazon Associate I earn from qualifying purchases.

Set the override before navigation so the page loads under the intended configuration. A site may ignore, vary, or block a particular User-Agent; the code cannot guarantee a specific site response.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright to set the User-Agent and take a screenshot

This JavaScript example creates a Chromium context with a custom User-Agent and viewport, opens a page, waits for DOM content, and saves a full-page PNG:

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
import { chromium } from 'playwright';

const browser = await chromium.launch();
try {
  const context = await browser.newContext({
    userAgent: 'Example custom user agent string',
    viewport: { width: 1280, height: 800 },
  });
  const page = await context.newPage();
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
  await browser.close();
}

Install Playwright and its browser runtime in the environment where the script will run. Replace the example User-Agent and URL with the values appropriate to your test. The userAgent context option is documented in Playwright emulation, while navigation and screenshot methods are documented in the Page API.

Choose the screenshot area

  • Viewport: omit fullPage or set it to false to capture the visible viewport.
  • Full page: use fullPage: true to capture content beyond the visible viewport.
  • One element: locate the element and call its screenshot method, for example await page.locator('main').screenshot({ path: 'main.png' });. Choose a selector that uniquely identifies the intended region.

Playwright’s screenshot tool reference describes screenshot target, full-page, output type, filename, and scale controls for its MCP tooling.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Wait for the state you need

domcontentloaded waits for the initial document to be parsed; it does not ensure that every image, font, or client-rendered component is ready. If the relevant content appears later, wait for a specific selector, or use a page-appropriate load condition. A fixed delay can be useful for a known animation or delayed update, but it is less reliable than waiting for the state your task requires. Pages with persistent network activity may never reach a network-idle condition, so select waits based on the page rather than assuming one condition fits all.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make the browser profile match the question

If you are checking a mobile layout, pair the User-Agent with a mobile-sized viewport and any other device properties the test requires. A desktop-sized viewport with a mobile User-Agent may produce a mixed configuration: the site sees one identity while the browser lays out a much larger screen. Playwright provides device emulation options in addition to the User-Agent setting; use a consistent profile when the distinction matters, and verify the rendered result rather than treating the string as proof of a device.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

For a targeted visual check, decide whether you need the viewport, a specific element, or the full scrollable page before capture. Larger full-page images can be harder for an agent to inspect and may include irrelevant sections; element captures narrow the view but can omit surrounding context.

Give the screenshot to the AI agent

Capturing an image and giving it to a model are separate operations. The browser automation produces a file or image result; the agent’s integration must then make that image available to the model. A browser agent may already provide a screenshot tool, in which case configure its supported User-Agent and capture options. Otherwise, run Playwright from a tool the agent can call and expose the saved image to the agent.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Use the screenshot for visual questions such as layout, chart appearance, clipping, or documenting a defect. If the agent needs text, element identity, or reliable interaction targets, pair the image with a structured accessibility or DOM-facing representation. Playwright’s Page API documents accessibility-oriented snapshots and references; its screenshot guidance distinguishes visual inspection from page structure and interactions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Puppeteer alternative

Puppeteer applies the override on a page rather than through Playwright’s context option. Set it before navigating:

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.setUserAgent('Example custom user agent string');
  await page.goto('https://example.com', { waitUntil: 'networkidle2' });
  await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
  await browser.close();
}

Puppeteer’s User-Agent API documents Page.setUserAgent(), and its screenshot guide covers page and element screenshots. The example uses networkidle2; pages that keep requests open may not satisfy that wait condition, so use a more appropriate wait for the target page when necessary. Playwright and Puppeteer use different APIs; do not mix their configuration calls.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. For a direct API call, send a URL and save the returned image:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo documentation for API options, including the custom User-Agent parameter. ScreenshotNeo also provides an MCP server with screenshot tools for AI agents. Before capture, it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for ScreenshotNeo and get 1,000 free screenshots a month with no card.

Troubleshooting

  • The page still looks like the default browser: confirm the custom string was set on the context or page before navigation, then reload the page in that session.
  • The layout does not look like a phone: User-Agent is not a complete device profile. Set a matching viewport and the relevant emulation properties, then capture again.
  • The screenshot is blank or missing late content: the page may not have finished rendering when capture ran. Wait for the content selector or another page-specific state before taking the screenshot.
  • The script hangs while waiting for network idle: the site may keep network requests open. Use a selector or another suitable readiness condition instead.
  • The capture omits the area you wanted: choose full-page capture for below-the-fold content, or capture a specific element for a focused region.
  • The agent cannot interpret the saved image: check whether its tool integration passes the image to the model. For text or interaction tasks, supply a structured accessibility or DOM-facing snapshot as well.

Frequently Asked Questions

Does changing the User-Agent guarantee that a website will show a different version?

No. The override changes the browser identity sent by the automation session, but the site decides how to respond and may ignore or block it.

Can an AI model change the browser User-Agent by itself?

Not unless the agent has a browser-control tool or can run automation code that exposes the setting.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.