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

With Playwright, set userAgent on a browser context before creating a page or navigating. Then navigate to the site and use the page’s screenshot API—or your agent’s screenshot tool—to capture the viewport, an element, or the full page. This changes the browser’s user-agent setting; it does not guarantee a particular layout or bypass bot protection.

Set a custom user agent before opening the page

A browser context holds settings for pages created within it. Configure the context first so the page uses the intended user-agent string from its first navigation. The following is an illustrative Playwright script; adapt the launch code to your installed browser package and runtime.

const browser = await chromium.launch();
const context = await browser.newContext({
  userAgent: "YOUR_INTENDED_USER_AGENT_STRING",
  viewport: { width: 1280, height: 800 }
});
const page = await context.newPage();
await page.goto("https://example.com");
await page.screenshot({ path: "page.png", fullPage: true });
await browser.close();

Playwright documents userAgent as a browser-context setting in its emulation guide. The script shows the order of operations and the documented screenshot API shape; it is illustrative, not a tested script. If an AI agent connects through MCP or a hosted browser rather than running Playwright code directly, use equivalent tool calls—but the integration must allow context configuration before navigation.

Choose the right browser identity and layout

Use a custom user-agent string when you specifically need to supply that string. If you want to reproduce a device more broadly, choose a documented device preset or configure its relevant settings as well. User agent and viewport are distinct: changing the string alone does not set every device characteristic or guarantee how a site will render. Playwright notes that device presets can include viewport and other emulation parameters; its Desktop Chrome preset uses a Windows-specific user agent. Its guide also explains how to unset a preset user agent when you want the host platform’s own value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
  • Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
  • Built-In Mic: The built-in microphone lets others hear you clearly during video calls
  • Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works

Set only the identity and layout details that match your legitimate testing or capture need. A mobile user-agent string paired with a desktop-sized viewport, for example, may not reproduce the mobile layout you are trying to inspect.

Wait for the state you want to capture

Navigate to the page, then wait for the content or state that matters to your screenshot. The right wait depends on the site: some pages render their main content immediately, while others populate it asynchronously. There is no single wait duration that is correct for every page. Prefer a meaningful condition—such as a selector becoming visible—when your setup supports it, and inspect the page if the expected content is still absent.

Capture the viewport, an element, or the full page

  • Viewport: capture the currently visible screen when the initial viewport is all you need.
  • Element: capture a particular component when you know its selector or target.
  • Full page: capture content below the fold as well as the initial screen.

Playwright’s screenshot guidance covers viewport, element, and full-page capture. Its MCP screenshot tool supports image type and filename options. Screenshots are useful for visual layout, canvas or chart content, and bug documentation; an accessibility snapshot is often more useful for reading structure, text, and interaction references. Use the two together when an image alone does not explain what the agent is seeing. See Playwright’s screenshot tool documentation.

Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
  • The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
  • C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
  • The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.

Use the Playwright agent CLI when it fits your workflow

If your agent uses Playwright’s agent CLI, its documented screenshot commands include:

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.
screenshot
screenshot [target]
screenshot --filename=page.png
screenshot --type=png
screenshot --full-page

The CLI screenshot command is useful for capture, but the custom user agent still needs to be configured in the browser context before navigation through the agent’s setup or supported configuration. Consult the Playwright Screenshots & PDF command documentation for the installed CLI’s options. It warns that high-resolution output uses device pixels, so screenshot coordinates may not match the CSS-pixel coordinates used by mouse commands.

Know what a custom user agent can and cannot do

A user-agent override changes the browser’s configured identity string. It does not promise that the server will return a particular version of a page, emulate all device behavior, or treat the request as human traffic. It is not a bot-protection bypass. Cloudflare states for its Browser Run Playwright integration: “The userAgent parameter does not bypass bot protection. Requests from Browser Run will always be identified as a bot.” See the Cloudflare Playwright guide.

Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
  • 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
  • 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.

Do not use a user-agent change to evade a site’s controls. If a page blocks automation or presents a bot check, respect the site’s access rules and use an authorized route or request permission rather than trying to disguise the automation.

Diagnose incomplete or unexpected screenshots

  • The page looks like the wrong device: verify the viewport and any other device settings, not only the user-agent string. A custom string by itself does not configure a complete device profile.
  • Content is missing: check whether the intended page state has loaded before capture. Use a condition tied to the content where possible; a fixed delay may be too short on one run and unnecessarily long on another.
  • The screenshot is hard to interpret: inspect an accessibility snapshot or DOM-oriented view alongside the image. Playwright describes screenshots and accessibility snapshots as complementary tools.
  • The site shows a bot check or denies access: a custom user agent does not override the site’s bot controls. Use an approved integration or obtain access from the site owner.
  • Mouse coordinates do not line up with the image: check whether high-resolution output is in device pixels while your mouse actions use CSS pixels.
  • Your agent cannot apply the setting: its browser integration may not expose context creation or user-agent configuration. This approach requires support for setting the context before navigation.

When a hosted browser is useful

Local Playwright is suitable when you can install and run the browser stack where the agent operates. A hosted browser can help when you need remote execution or browser sessions without managing that local setup. Cloudflare Browser Run documents hosted headless browsers, screenshots, browser sessions, and Playwright integration. Its documentation distinguishes stateless screenshot tasks from browser sessions with fuller control: Cloudflare Browser Run.

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

Cloudflare’s pricing documentation states that Workers Free includes 10 minutes of browser time per day and Workers Paid includes 10 hours per month before additional charges. These are provider plan terms, not a general allowance for hosted browsers; confirm the current details on the Cloudflare Browser Run pricing page before relying on them.

Rank #4
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera
  • 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
  • Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
  • Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
  • Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
  • High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. A single request can return an image or PDF. For API options and accepted parameters, see the ScreenshotNeo documentation.

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

ScreenshotNeo is an option when you want a capture service rather than managing a browser context yourself: it accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with response headers indicating the page verdict and billing status; and its MCP server provides tools for AI agents, including take_screenshot, get_page_info, and capture_pdf. It does not make a custom user-agent setting a way to bypass a site’s controls.

The Free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 screenshots. Every feature is available on every plan. Sign up for free: 1,000 screenshots a month, no card.

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

Other screenshot libraries

Puppeteer also documents a Page.screenshot() API. It is another possible capture route, but the available documentation here does not establish a performance or image-fidelity winner between Puppeteer and Playwright. See the Puppeteer screenshot API reference.

Best Value
Sale
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
  • Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
  • Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
  • Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video

Frequently Asked Questions

Can I change the user agent after navigating?

For the context-based workflow described here, set it when creating the browser context, before creating the page and navigating.

Does a custom user agent guarantee the mobile version of a site?

No. The string and viewport or other device-emulation settings are separate; the site also determines what it serves.

Can a screenshot tell my agent what text and controls are on a page?

An image can show appearance, but an accessibility snapshot or DOM-oriented view is often more useful for structure, text, and interaction references.

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

Quick Recap

SaleBestseller No. 1
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Built-In Mic: The built-in microphone lets others hear you clearly during video calls
$24.99
SaleBestseller No. 2
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Compatible with Nintendo Switch 2’s new GameChat mode
$16.04
SaleBestseller No. 5
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Fully compatible with Windows 11
$54.99

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.