Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use Playwright to visit each site, operate that site’s own search control, wait for a result-specific condition, and save the appropriate screenshot. The reliable pattern is a data-driven loop with per-site selectors and readiness checks—not one universal search selector. This guide shows a runnable JavaScript workflow, explains viewport, full-page and element captures, and covers failures, dynamic results, access rules and a no-browser API alternative.
The reliable workflow
For every target, your script should:
- Keep the URL and search configuration in an explicit object.
- Launch one browser and create a context with the desired viewport.
- Navigate to the target URL.
- Find its search field and submit the query.
- Wait for a signal that results are ready.
- Capture the required scope and record success or failure independently.
Playwright’s Page API supplies the browser, context, navigation and screenshot primitives. Its locator model provides auto-waiting and retry-ability, but it cannot know what “results ready” means on an arbitrary website. That condition must be chosen for each target.
Install and prepare the project
Use a current Node.js release, then create a project and install Playwright:
mkdir site-search-captures
cd site-search-captures
npm init -y
npm install playwright
npx playwright install chromium
Chromium is enough for this example. Install other Playwright browser engines if your compatibility requirement calls for them. Keep the query and target list in configuration rather than embedding them throughout the loop.
#1 Best Overall
- FULL HD IPS DISPLAY - Enjoy vibrant, crystal-clear images with 178-degree wide-viewing angles
- AMD RYZEN 3 30 PROCESSOR - Everyday performance you can count on; Multitask, stream, game casually, and edit photos smoothly with responsive power and vibrant HDR visuals
- ENJOY UP TO 14 HOURS AND 15 MINUTES OF BATTERY LIFE - HP Fast Charge restores battery from 0 to 50% in approximately 45 minutes
- AMD RADEON 610M GRAPHICS - Experience smooth entertainment; Built for streaming and multitasking, enjoy realistic visuals and efficient performance for work and play
- STORAGE AND MEMORY - 512 GB PCIe NVMe M.2 SSD offers fast speed and efficient storage; and 8 GB LPDDR5 RAM memory boosts performance with higher bandwidth
A complete JavaScript example
The following is an adaptable implementation. The labels and result conditions are illustrative: inspect each target and replace them with values that match its accessible markup.
const { chromium } = require('playwright');
const fs = require('node:fs/promises');
const targets = [
{
name: 'Example A',
url: 'https://example.com',
searchLabel: 'Search',
resultHeading: /search results/i
},
{
name: 'Example B',
url: 'https://example.org',
searchLabel: 'Search this site',
resultHeading: /results/i
}
];
const query = 'the phrase to search';
const outputDir = './shots';
(async () => {
await fs.mkdir(outputDir, { recursive: true });
const browser = await chromium.launch();
const context = await browser.newContext({
viewport: { width: 1440, height: 900 }
});
const report = [];
try {
for (const target of targets) {
const page = await context.newPage();
try {
await page.goto(target.url, { waitUntil: 'domcontentloaded', timeout: 45000 });
const field = page.getByLabel(target.searchLabel);
await field.fill(query);
// If the site has no named button, use its documented keyboard or form action.
await page.getByRole('button', { name: /search/i }).click();
// Replace this with a target-specific heading, container, URL, or other signal.
await page.getByRole('heading', { name: target.resultHeading }).waitFor({
state: 'visible',
timeout: 30000
});
const safeName = target.name.replace(/[^a-z0-9_-]+/gi, '_');
const file = `${outputDir}/${safeName}.png`;
await page.screenshot({ path: file, fullPage: true });
report.push({ name: target.name, ok: true, file });
} catch (error) {
report.push({ name: target.name, ok: false, error: error.message });
console.error(`Could not search ${target.name}: ${error.message}`);
} finally {
await page.close();
}
}
} finally {
await browser.close();
}
console.table(report);
})();
Save it as search-and-capture.js and run node search-and-capture.js. A failed site is logged while later sites continue, and the final table gives your pipeline a machine-readable starting point for reporting.
Make selectors site-specific
Prefer accessible controls
Start with getByLabel() for form fields and getByRole() for buttons, headings and links. These user-facing selectors are generally more durable than generated CSS classes. A label such as “Search this site” is not equivalent to “Search,” so store it with the target.
When there is no visible label
A site may expose only a search icon, an input with a placeholder, or a form that submits on Enter. Adapt the interaction rather than forcing one selector:
Rank #2
- Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.
- 14" HD Display: 14.0-inch diagonal, HD (1366 x 768), micro-edge, anti-glare. See your digital world in a whole new way. Enjoy movies and photos with the great image quality and high-definition detail of 1 million pixels.
- Memory & Storage: 4 GB LPDDR4x & 64 GB eMMC Storage. Adequate high-bandwidth RAM to smoothly run multiple applications and browser tabs all at once. An embedded multimedia card provides reliable flash-based storage.
- Ports:2 x USB 3.0 Type-A,1 x USB 3.0 Type-C,1 x HDMI,1 x Headphone Jack
- Chrome OS: Chromebook is a computer for the way the modern world works, with thousands of apps. Enjoy the seamless simplicity that comes with Google Chrome and Android apps, all integrated into one laptop. It’s fast, simple, and secure.
await page.getByPlaceholder('Search articles').fill(query);
await page.keyboard.press('Enter');
If an icon opens a search drawer, click the icon first, wait for the field, then fill it. If the site has a stable, documented CSS contract, a locator such as page.locator('form[role="search"] input') can be an explicit fallback.
Wait for the actual result state
Use a result heading, a results container, a URL change, or a site-specific completion message. A fixed delay alone is fragile: it may be too short on a slow run and wasteful on a fast one.
await page.waitForURL(//search?q=/, { timeout: 30000 });
await page.locator('[data-testid="search-results"]').waitFor({ state: 'visible' });
For dynamically changing lists, wait for the container or a stable count before reading individual items. Calling locator.all() immediately can be unpredictable while matching elements are still being added.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Choose the screenshot scope
| Capture | Playwright option | Use it when |
|---|---|---|
| Viewport | page.screenshot({ path: 'view.png' }) |
You need exactly what a user sees in the configured viewport. |
| Full page | page.screenshot({ path: 'page.png', fullPage: true }) |
The evidence must include the complete scrollable results page. |
| One element | page.getByRole('main').screenshot({ path: 'results.png' }) |
Headers, navigation and unrelated page content should be excluded. |
Set the viewport before navigation so responsive breakpoints and layout-dependent content are rendered consistently. For repeatable evidence, also keep the browser engine, viewport, color scheme and locale consistent.
Rank #3
- Stunning 15.6" FHD IPS Display: Experience crisp 1920x1080 resolution on this 15.6 inch laptop with an IPS panel that delivers wide viewing angles and vivid colors. The narrow-bezel design maximizes screen real estate for comfortable viewing on this Win 11 laptop, whether you're studying or working.
- Celeron J4105 Processor & 256GB SSD: Powered by a reliable Celeron J4105 processor paired with 12GB DDR4 memory and a fast 256GB M.2 SSD. This laptop computer supports SSD expansion up to 2TB and TF card expansion up to 1TB, so your storage grows with your needs. Delivers smooth multitasking for daily productivity.
- AI-Powered Win 11 Laptop: Built-in AI features enhance your productivity with smart assistance for writing, summarizing, and task management. Pre-installed with Win 11 and includes Office 365 subscription. This student laptop is backed by 1-year warranty and 24/7 customer support.
- All-Day 7000mAh Battery & 180° Hinge: The high-capacity 7000mAh battery keeps this laptop powered through long classes or meetings. The 180-degree lay-flat hinge lets you share your screen effortlessly during presentations. This durable laptop computer adapts to your dynamic workflow.
- Versatile Connectivity Hub: Equipped with USB 3.2, Type-C, Mini HDMI, and 3.5mm audio jack to connect all your peripherals. Stay online anywhere with high-speed 5G WiFi and Bluetooth 4.2. This college laptop keeps you connected at home, in the library, or on the go.
Capturing multiple result views
A full-page image may be very tall, while a viewport image can hide lower results. Capture both when the evidence has two purposes:
await page.screenshot({ path: `${safeName}-viewport.png` });
await page.screenshot({ path: `${safeName}-full.png`, fullPage: true });
await page.getByRole('main').screenshot({ path: `${safeName}-results.png` });
Use element screenshots only after the element is visible and laid out. If lazy-loaded images matter, scroll or wait for the images’ loading state before capture; otherwise the screenshot can show placeholders.
Handling real-world sites
Consent banners, overlays and popups
A cookie dialog can intercept the search button, and newsletter or chat overlays can obscure the evidence. If the site permits it, locate and accept or dismiss the banner before searching. Keep that action in the target configuration because consent controls differ widely.
JavaScript-rendered results
Navigation completion does not mean an asynchronous search has finished. Wait for the result heading, network-driven container, or URL state that the site actually uses. Avoid treating a successful HTTP response as proof that the visual result is ready.
Authentication and restricted content
Use a dedicated test account only when you are authorized. A persistent browser context can retain a permitted login, but do not commit its storage state or secrets to source control. Some sites intentionally prevent automated access, and a browser script does not override those rules.
Rank #4
- Efficient Performance for Everyday Computing: Powered by Intel N150 processor with up to 3.6 GHz Intel Turbo Boost Technology, 6 MB L3 cache, 4 cores, and 4 threads, this HP laptop delivers responsive performance for web browsing, streaming, document editing, and multitasking. Paired with 4GB LPDDR5 RAM and 128GB UFS storage, it handles daily tasks smoothly. Includes 1-year Microsoft 365 Personal subscription for Word, Excel, PowerPoint, and cloud storage to maximize your productivity.
- 14-Inch HD Micro-Edge Display:Enjoy clear visuals on the 14-inch HD (1366 x 768) anti-glare screen with 250-nit brightness and 62.5% sRGB coverage. The micro-edge bezel delivers a 79% screen-to-body ratio in a compact design. An HP True Vision 720p HD camera with noise reduction and dual-array microphones supports clear video calls, remote work, and online learning.
- Modern Connectivity and Wireless Technology: Stay connected with Wi-Fi 6 (2x2) for faster wireless speeds and Bluetooth 5.4 for seamless pairing with accessories. Versatile port selection includes 1 USB Type-C 10Gbps with DisplayPort 1.2 for external displays, 2 USB Type-A 5Gbps ports for peripherals, 1 HDMI 1.4b port, 1 headphone/microphone combo jack, and 1 multi-format SD media card reader. Connect monitors, transfer files quickly, and expand your workspace with ease.
- All-Day Battery Life and Portable Design: Enjoy up to 11 hours of video playback, 7.5 hours of mixed usage, or 7.5 hours of wireless streaming on a single charge, perfect for students and professionals on the go. Weighing just 3.24 lb and measuring 12.76" x 8.86" x 0.71", this lightweight laptop fits easily in backpacks and bags. The stylish willow green top cover with matte finish and natural silver keyboard deck with vertical brushing pattern offer a modern, professional look.
- AI-Enhanced Productivity: Access Microsoft Copilot instantly with the dedicated Copilot key for faster assistance. AI Noise Reduction filters background sounds and improves voice clarity during calls. Dual speakers provide clear audio, while the full-size natural silver keyboard and HP Imagepad support comfortable typing and navigation.
Rate limits and responsible access
Check the target’s terms, robots guidance where applicable, rate limits and any official search API. Space requests, keep the URL list bounded, and prefer an API when it provides the same data with less load and clearer permission.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Reliability, performance and cost decisions
Reuse the browser, isolate pages
Launching one browser and context for a sequence avoids repeated startup overhead. Opening a fresh page for each target isolates cookies, DOM state and errors. If targets must share a login, deliberately reuse a context; otherwise create separate contexts for stronger isolation.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsUse bounded timeouts and retries
Set navigation and readiness timeouts that match your environment. Retry transient navigation failures with a small limit, but do not blindly repeat selector failures: a missing locator usually indicates a site-specific adapter problem. Save an error screenshot or HTML snapshot on failure when your handling policy allows it.
Control concurrency
Serial processing is simplest and gentlest to target sites. For a large authorized list, a small concurrency limit can reduce total runtime, but launching one page per URL without a bound can exhaust memory and trigger rate limits.
Best Value
- Efficient Intel Processor: Powered by Intel Celeron 5205U dual-core two-thread processor with a fixed 1.9GHz base frequency, 2MB Intel Smart Cache and advanced 14nm Comet Lake lithography. Integrated Intel UHD Graphics for 10th Gen Intel Processors delivers stable daily performance. It handles daily office tasks, web browsing, video streaming and light multitasking smoothly while featuring ultra-low power consumption for extended use.
- Fast Response Large Storage:Equipped with 12GB high-speed RAM to accelerate program loading and enable seamless multitasking. Built-in 256GB solid-state drive provides rapid boot and application launch speeds, offering ample storage space for your documents, software, photos and videos. Run daily productivity and multimedia applications without lag or slowdowns.
- 15.6" FHD IPS Eye-Care Display:This laptop features a 15.6-inch Full HD IPS panel with native 1920×1080 resolution and classic 16:9 widescreen ratio. Designed with slim 5mm ultra-narrow bezels, anti-glare coating and blue light filtering eye protection, it effectively reduces eye strain during long hours of studying, streaming or working, delivering vivid, immersive visual experiences. effectively reduce blue light and eye strain, bringing you immersive visual experience for watching videos and studying.
- Pre‑Installed Windows 11: Ready to Use Comes with a genuine Windows 11 system pre‑loaded, offering a clean, intuitive interface and broad software compatibility. Open the box, power on, and you're all set for school assignments, business reports, or daily computing needs.
- Rich Ports & Long Lasting Battery Life:Built-in 38Wh rechargeable battery and dual stereo speakers. Support Bluetooth 4.2 & 2.4G/5G dual-band WiFi for fast wireless connection. Equipped with Type-C, HDMI, 3.5mm audio jack, dual USB 3.0, Micro TF slot and DC charging port, meet your daily external device connection and office expansion needs.
Make files and reports deterministic
Sanitize names, include a timestamp or query identifier when runs must coexist, and write a JSON report containing URL, query, status, output path and error. This makes a missing screenshot distinguishable from a site that legitimately returned no matches.
Common failures and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| “Locator not found” | The label, role or name differs on this site. | Inspect accessible names; change the target’s locator or add a site adapter. |
| Button is covered | Consent, newsletter or chat overlay. | Dismiss the permitted overlay, then retry the click. |
| Timeout waiting for results | Wrong readiness condition, slow async rendering, or blocked request. | Use the site’s actual result locator or URL; increase the bounded timeout only after validating the condition. |
| Screenshot is blank or incomplete | Capture occurred before layout or lazy content settled. | Wait for the result element and relevant images; capture the element or full page intentionally. |
| Later sites never run | Error handling surrounds the whole loop. | Keep try/catch/finally inside each iteration and close each page in finally. |
| Dynamic item list changes while reading | Enumeration happened before the list stabilized. | Wait for a stable container or count before collecting items. |
| Navigation is denied | Target policy, bot protection, authentication or network restrictions. | Stop or use an authorized API; do not attempt to bypass controls. |
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server when you already know the result URL to capture. One GET request returns PNG, JPEG, WebP or PDF. It can accept consent banners before capture and remove more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. 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.
Recommended Free Tools
For a search workflow, keep Playwright (or an official site search API) for the site-specific interaction, then send each resulting URL to ScreenshotNeo for consistent evidence:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
JavaScript developers can call it directly:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const image = Buffer.from(await res.arrayBuffer());
require('node:fs').writeFileSync('shot.webp', image);
Python is useful in a mixed-language pipeline:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
See the ScreenshotNeo documentation for parameters and response headers. Options include full-page capture with lazy images, CSS-selector element capture, dark mode, 12 device presets or custom viewports, retina scale, PDF paper settings and page ranges, custom CSS and JavaScript, clicks, selector or network-idle waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen TTL caching, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data and an OpenAPI specification. Existing parameter names used by other screenshot APIs also work.
An MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients, so an AI agent can perform the capture. Plans include 1,000 shots per month free with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to start.
FAQ
Can one selector search every website?
No. Search labels, icons, forms and result markup vary. Configure each target or write a small adapter.
Free tools Windows power users keep installed
One-click scans. No signup required.
Should I use a website’s search API instead?
Use an official API when it supplies the needed results and your authorization permits it. Browser automation is appropriate when the visual interaction or rendered page is the evidence.
When should I choose an element screenshot?
Choose it when only the result panel is evidence. Use a viewport capture for visible context and full-page capture for the complete scrollable document.
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.

