Wait for the selector to reach the state your capture needs, then take a page or element screenshot. In Playwright, use a locator; in Puppeteer, use page.waitForSelector(). Set a finite timeout so a missing or late element produces a clear failure instead of a misleading image.
Choose the right selector state before capturing
A selector appearing in the DOM does not necessarily mean it is displayed. In Playwright, attached means a matching node exists; visible requires a non-empty bounding box and that the element is not visibility:hidden. Puppeteer’s visible: true likewise waits for a matching element that is not hidden by display:none or visibility:hidden.
As an Amazon Associate I earn from qualifying purchases.
Use visibility when the screenshot should show the element. If the element’s presence is enough, use the attached state in Playwright or omit Puppeteer’s visible option. If a page inserts the container before rendering its final text or data, wait for that content too; the container becoming visible alone may be too early.
Playwright: wait with a locator, then capture
This runnable Node.js example navigates to a page, waits up to 10 seconds for .ready to become visible, and saves a full-page PNG. Replace the URL and selector with the page and state you need.
#1 Best Overall
- 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
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
try {
const page = await browser.newPage();
const url = 'https://example.com';
const selector = '.ready';
await page.goto(url);
const target = page.locator(selector);
await target.waitFor({ state: 'visible', timeout: 10_000 });
await page.screenshot({ path: 'page.png', fullPage: true });
} catch (error) {
console.error(`Screenshot failed for selector .ready: ${error.message}`);
process.exitCode = 1;
} finally {
await browser.close();
}
})();
To save only the matched element instead, replace the page screenshot line with:
await target.screenshot({ path: 'element.png', animations: 'disabled' });
A locator is resolved against the current DOM when each operation runs, which is useful on pages that re-render. locator.waitFor() defaults to visible, and also accepts attached, hidden, and detached. The explicit state makes the intended condition clear. Playwright marks page.waitForSelector() as discouraged in favor of locator waits or web-first assertions.
The 10-second timeout is an example, not a universal recommendation. Locator waits have a documented default timeout of zero unless configured, so provide a bound or configure one for your project.
Rank #2
- 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.
Wait for particular content, not just the container
If .ready is visible before its data arrives, add a web-first assertion for the expected text before capture. For example, with Playwright Test’s expect:
const { expect } = require('@playwright/test');
await expect(page.locator('.ready')).toContainText('Report complete', {
timeout: 10_000,
});
await page.screenshot({ path: 'report.png', fullPage: true });
Choose text or another observable final-state condition that actually matters to the image. A fixed sleep can be too short on a slow run and waste time on a fast one.
Puppeteer: waitForSelector, then capture
Puppeteer’s page.waitForSelector() accepts CSS selectors and resolves immediately if a matching node already exists. Set visible: true if it must be displayed. This example waits up to 10 seconds and writes a full-page screenshot:
Rank #3
- 【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.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
const url = 'https://example.com';
const selector = '.ready';
await page.goto(url);
const target = await page.waitForSelector(selector, {
visible: true,
timeout: 10_000,
});
await page.screenshot({ path: 'page.png', fullPage: true });
} catch (error) {
console.error(`Screenshot failed for selector .ready: ${error.message}`);
process.exitCode = 1;
} finally {
await browser.close();
}
})();
To capture the matched node rather than the page, use the returned element handle:
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesawait target.screenshot({ path: 'element.png' });
Puppeteer’s documented default wait timeout is 30 seconds; override it to suit the page and job. If an iframe contains the selector, use that frame’s waitForSelector(); a top-level page selector does not automatically search inside a separate frame.
Full page or just the selected element?
| Capture | Use it when | Important behavior |
|---|---|---|
Playwright page.screenshot({ fullPage: true }) or Puppeteer page.screenshot({ fullPage: true }) |
You need the whole scrollable page after the readiness condition is met. | A page screenshot is not limited to the selector. The selector is the trigger for when to capture. |
Playwright locator.screenshot() or Puppeteer element-handle screenshot() |
You need an image clipped to the matched element. | The operation scrolls the target into view as needed. For a scrollable container, only the content currently scrolled into view is captured; another element covering the target may affect how it looks. |
Choose the scope based on what the person receiving the image needs to inspect. An element image is not a substitute for a full-page capture.
Rank #4
- 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)
Make captures more repeatable
Animations and dynamic widgets can make successive screenshots differ. Playwright screenshot options support disabling animations, masking selected regions, applying a stylesheet, and choosing output type and scale. A locator screenshot also supports options such as hiding the caret and specifying a path; PNG is the documented default. For example:
await page.screenshot({
path: 'page.png',
fullPage: true,
animations: 'disabled',
mask: [page.locator('.live-clock')],
});
Use masks or temporary CSS only when omitting or changing those regions is acceptable for the purpose of the image. Prefer the selector or expected content as the readiness signal: Playwright’s Page reference discourages networkidle as a general testing readiness test.
Troubleshoot missing or misleading screenshots
- The wait times out: Check that the selector is valid and that the page actually reaches the requested state. Include the URL and selector in the error context, and fix the underlying loading or selector issue rather than silently capturing anyway.
- The selector matches too early: The node may exist before its contents finish rendering. Wait for expected text or a selector that represents the final state.
- The element exists but is not visible: Use
visiblewhen display matters. In Playwright,attachedonly establishes DOM presence, not a visible box. - The wrong content is captured from an iframe: Find the relevant frame and perform the wait there; the top-level page does not search the frame’s DOM as if it were its own.
- The element image is incomplete: In a scrollable container, an element screenshot includes only the currently scrolled content. Capture a full-page image or adjust the container’s scroll position if that better matches the need.
- The image changes between runs: Disable animations or mask volatile regions in Playwright. Avoid treating arbitrary delays or network-idle status as proof that the desired content is ready.
Or skip the browser setup
ScreenshotNeo can wait for a selector and return a screenshot through one GET request. The API accepts common screenshot parameter names, including wait_for; see the ScreenshotNeo API documentation for the current request options and response details.
Best Value
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://stripe.com
-d wait_for='.ready'
-o shot.webp
ScreenshotNeo accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up free for 1,000 screenshots a month—no card required.
Frequently Asked Questions
Can I use a CSS selector with either library?
Yes. Playwright locators and Puppeteer’s page.waitForSelector() accept CSS selectors for this workflow.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Does waiting for a selector guarantee its images have loaded?
No. It establishes the requested selector condition, not that every image or other asset on the page has finished loading.
Quick Recap
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.




