What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To save content rendered inside an iframe, use page.frameLocator() to enter the frame and call screenshot() on a locator inside it:

await page.frameLocator('#my-iframe')
  .locator('body')
  .screenshot({ path: 'iframe.png' });

Use a narrower locator than body if you only need one element. To capture the parent page with the iframe in its on-page context, use page.screenshot() instead.

Choose what you want in the image

An iframe has its own document, so the right screenshot method depends on whether you need the iframe’s contents or the page around it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
What to capture Playwright approach What the result includes
One component inside the iframe page.frameLocator(iframeSelector).locator(innerSelector).screenshot() The matched element inside the selected frame.
The iframe document’s body page.frameLocator(iframeSelector).locator('body').screenshot() The body element’s rendered bounds; its size depends on the document and layout.
The parent page as shown in the viewport page.screenshot() The page view, including the iframe in its position on the parent page.
The scrollable parent page page.screenshot({ fullPage: true }) The full parent page rather than only the current viewport.

These methods capture different targets. A locator screenshot is for a matched element; a page screenshot is for page context. The Playwright screenshots documentation describes page screenshots and the full-page option, while FrameLocator documentation covers locating elements inside a frame.

#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

Capture an element inside an iframe

Use a stable selector for the iframe, then locate the target inside it. This runnable example uses Playwright Test with TypeScript syntax:

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

test('capture a widget inside an iframe', async ({ page }) => {
  await page.goto('https://example.com');

  const widget = page
    .frameLocator('iframe[data-testid="payment-frame"]')
    .getByRole('heading', { name: 'Payment details' });

  await widget.screenshot({ path: 'payment-heading.png' });
});
  1. Replace the example URL with the page you are testing.
  2. Replace iframe[data-testid="payment-frame"] with a selector that identifies the intended iframe.
  3. Change the role and accessible name to match the element to capture, or use another stable locator.
  4. Run the test in your project; Playwright writes the image to payment-heading.png relative to the test’s working directory.

Playwright recommends user-facing locators or explicit testing contracts such as test IDs. The locator methods are available from FrameLocator; see the locators guide.

Capture the iframe body

If the whole iframe document area is the target, use body as the inner locator:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
await page.frameLocator('iframe#my-iframe')
  .locator('body')
  .screenshot({ path: 'iframe.png' });

The image bounds are determined by the body element’s rendered size and page layout. If this does not produce the area you expect, target a specific component or capture the parent page instead.

Capture the iframe in the parent page

When placement and surrounding content matter, take a page screenshot rather than a screenshot of an element inside the frame:

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

For the full scrollable parent page, use:

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

A full-page screenshot concerns the parent page’s scrollable area; use a frame locator when your target is specifically an element within the iframe.

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.

Make the capture reliable

  • Select the intended frame. If the page has multiple iframes, identify the correct one by a stable id, name, or test ID, and use a stable inner locator too.
  • Let locator behavior handle readiness. Playwright resolves locators when they are used and its locator approach supports auto-waiting and retryability. Prefer that synchronization model over a fixed sleep as the default.
  • Disambiguate matches. Frame locators are strict when a selector resolves ambiguously. Narrow the iframe selector rather than depending on which matching frame is chosen.
  • Check the capture target. If the screenshot lacks surrounding page content, the code may have captured an element rather than the parent page.
  • Check your binding and version. The examples here use the JavaScript/TypeScript API. Other language bindings and older installed releases can have different syntax or feature availability. The Playwright API documentation marks page.frameLocator() as added in v1.17.

Current Playwright documentation also describes selector-free page.frameLocator() behavior for searching across frames, but matches can be ambiguous when several frames contain the target. For an intentional screenshot, selecting the frame explicitly is clearer. See the Page API documentation and release notes.

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

Troubleshoot common iframe screenshot problems

The screenshot times out or the target is not found

Check that the iframe selector matches the iframe on the loaded page and that the inner selector exists within that frame. Narrow or correct the selectors, and use a locator that identifies a rendered element. Avoid adding arbitrary sleep time before verifying what is missing.

The wrong iframe is selected or the locator is ambiguous

Use a more specific iframe selector based on a stable id, name, or test ID. If the same selector matches multiple frames, make the frame choice explicit rather than relying on ambiguous selection.

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)

The image contains only the widget, not the surrounding page

That is the expected result of calling screenshot() on a locator inside the iframe. Use page.screenshot() if you need the iframe positioned within its parent page.

The image is cropped or not the full frame content

A screenshot of body uses that element’s rendered bounds; it is not the same request as a full-page screenshot of the parent. Choose a specific inner element for a component, or use the page screenshot with fullPage: true when you need the parent’s scrollable page.

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

The example syntax does not work in your project

Confirm that the project uses the JavaScript/TypeScript Playwright API and check the installed version. The documentation reviewed here is for that binding; Python, Java, .NET, and older releases can expose different syntax or feature availability.

Best Value
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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot of the page containing the iframe rather than a specific element within its document, ScreenshotNeo can return a page image with one GET request. It is a website screenshot API and MCP server for developers, made by Yorker Media. This does not replace Playwright’s frame locator when your target is a specific element inside the iframe.

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 API documentation for request options. Before capture, cookie banners are accepted and removed, along with known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. Its MCP server gives AI agents tools for screenshots, page information, and PDF capture. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo to get 1,000 free screenshots a month with no card.

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
$35.80
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.89
Bestseller 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
$69.99

Further reading

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.