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

Use BrowserCat with Playwright to open a URL in a managed browser, set a capture viewport, wait for the page content you need, and save a screenshot. The image is a rendering of the page—not a guarantee that a social network will accept it or display it as intended. Check the target platform’s current image requirements separately.

What you need

  • A BrowserCat API key. Keep it in an environment variable; do not put it in browser-delivered code or commit it to a repository.
  • Node.js and the Playwright package. BrowserCat recommends Playwright as the starting library; its documentation also describes Puppeteer and CDP-based clients. These are vendor-stated capabilities, not an independent compatibility test. See BrowserCat’s quick start and BrowserCat’s site.
  • A public or otherwise browser-accessible page URL, and a decision about whether the output should show the viewport, a full page, or one element.

BrowserCat’s documented WebSocket endpoint is wss://api.browsercat.com/connect. The quick start authenticates by sending the API key in an Api-Key header.

Generate a preview image with Playwright

Install Playwright in your project with npm install playwright. Save this as preview.mjs:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { chromium } from 'playwright';

const targetUrl = process.argv[2];
if (!targetUrl) {
  throw new Error('Usage: node preview.mjs https://example.com');
}
if (!process.env.BROWSERCAT_API_KEY) {
  throw new Error('Set BROWSERCAT_API_KEY before running this script.');
}

const browser = await chromium.connect('wss://api.browsercat.com/connect', {
  headers: { 'Api-Key': process.env.BROWSERCAT_API_KEY },
});

try {
  const page = await browser.newPage();
  // Illustrative composition only. Verify the current requirements of your target platform.
  await page.setViewportSize({ width: 1200, height: 630 });
  await page.goto(targetUrl, { waitUntil: 'load' });
  await page.screenshot({ path: 'preview.png' });
} finally {
  await browser.close();
}
  1. Set the API key in your shell environment. For example, on macOS or Linux: export BROWSERCAT_API_KEY='your-key'. Use your operating system’s secret-management method in deployed applications.
  2. Run node preview.mjs https://example.com, replacing the URL with the page to capture.
  3. Open preview.png and check the crop, text legibility, and loaded assets. Test the image with the platform’s current preview or debugging workflow before relying on it.

The 1200 × 630 viewport in the example is an illustrative code choice, not a BrowserCat recommendation or a claim about any social network’s current specification. The endpoint, authentication pattern, navigation, and screenshot flow follow BrowserCat’s quick start; viewport and screenshot controls are covered in its Playwright cheatsheet.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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

Wait for the content that belongs in the image

waitUntil: 'load' waits for the page load event, but a page can render important content later through client-side JavaScript, delayed requests, or lazy loading. If the title or hero image is missing, wait for the specific element that matters before capturing rather than relying on a fixed delay alone:

await page.goto(targetUrl, { waitUntil: 'load' });
await page.locator('h1').waitFor({ state: 'visible' });
await page.screenshot({ path: 'preview.png' });

Replace h1 with a selector that identifies the content you need. If an image is essential, wait for that image to be visible and, where appropriate, verify it has finished loading. A selector timeout usually means the selector is wrong, the page did not render that element, or the page took longer than the wait limit; inspect the URL and selector, then choose a suitable timeout for your page. BrowserCat’s docs establish the browser and screenshot mechanics, not a guarantee that every site’s dynamic content will be ready automatically.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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

Choose the capture shape and image format

Choice Use it when Considerations
Viewport screenshot You want a fixed, landscape or portrait composition sized to the visible browser area. Set the viewport before navigation or capture and inspect the resulting crop. Platform dimensions and file limits are not established here; confirm them with the target platform.
Full-page screenshot You need the entire vertically scrolling page. Playwright supports fullPage: true. A tall page capture is usually a different deliverable from a compact social preview.
Element screenshot The page has a composed card or hero region that should be isolated. Use a locator screenshot, for example await page.locator('.hero').screenshot({ path: 'hero.png' }). The selector must match a visible element.
PNG You want the standard lossless screenshot output shown in the basic example. Useful when crisp text or sharp edges matter; the best format depends on the destination and image content.
JPEG You prefer a compressed photographic image. Playwright supports JPEG and a quality setting, for example await page.screenshot({ path: 'preview.jpg', type: 'jpeg', quality: 85 }). Check the downstream platform’s accepted formats and limits.

The BrowserCat cheatsheet also documents clipping, masks, and custom screenshot styles. Clipping changes the captured area; a mask can obscure selected regions, but do not treat it as a security control for sensitive page content. Injected styles alter the rendered appearance and do not change the page’s social metadata. See the Playwright screenshot options.

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

Use BrowserCat configuration only when needed

The basic capture needs only the documented connection endpoint and API-key header. BrowserCat’s configuration overview says settings may be passed as query parameters or in the BrowserCat-Opts header, and that header keys take precedence when both are supplied. It gives browser choice and proxy configuration as examples. Those settings are unnecessary for a straightforward screenshot; check the current configuration guide before depending on configuration details, which may change.

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.

Troubleshooting

  • Connection fails: Confirm that the endpoint is exactly wss://api.browsercat.com/connect, the API key is valid, and the key is sent as the Api-Key header. Keep the key out of source control and client-side code.
  • The output is blank or missing the main content: Check that the URL loads in a browser and that the selector you wait for matches the page. Client-rendered content may appear after the load event; wait for the relevant visible element.
  • The image has the wrong crop: Set the viewport deliberately and use a viewport screenshot for a fixed composition. For a precomposed area, capture its locator; use full-page capture only when a tall page is intended.
  • The saved image is not in the expected format: Match the extension to the selected screenshot type. The examples save PNG by default and explicitly select JPEG when requested.
  • The preview looks wrong on a social network: A successful browser capture does not establish platform compliance. Verify that platform’s current dimensions, file-size and format rules, then test the result with its current preview or debugging tool.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its one-call API can return a screenshot or PDF without setting up a remote Playwright browser. Its documented API options include viewport and device presets, full-page and element capture, output format, custom CSS and JavaScript, and waits; see the ScreenshotNeo API documentation.

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

ScreenshotNeo removes known cookie-consent banners, newsletter popups, and chat widgets before capture, and each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s 1,000 free screenshots a month—no card required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Does a BrowserCat screenshot set a page’s social preview metadata?

No. It captures the rendered page; it does not establish or modify the page’s Open Graph or other social metadata.

Can I use Puppeteer or a CDP client instead of Playwright?

BrowserCat describes support for Puppeteer and CDP-based clients, but its quick start recommends Playwright as the starting point. Check BrowserCat’s current documentation for the client you plan to use.

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.

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.