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

To capture cross-browser screenshots with LambdaTest from Node.js, send an authenticated JSON POST request to https://api.lambdatest.com/screenshots/v1/, save the returned test_id, then request that test’s details from the corresponding GET endpoint. LambdaTest’s official references document the HTTP contract; the Node.js code below is a standard fetch implementation, not a vendor-published Node.js SDK example. The documented API workflow is not described as India-specific.

What you need before making the request

  • A LambdaTest account with its account username and access key. The setup guide says to retrieve these from the account dashboard and use the environment variables LT_USERNAME and LT_ACCESS_KEY. See LambdaTest’s credentials setup guide.
  • A Node.js version whose built-in fetch is available, or an alternative HTTP client if your project’s runtime does not provide it. Check compatibility with the Node.js version used by your application.
  • A target page URL reachable by the screenshot service, plus a browser and operating-system configuration selected from the current supported combinations in your account or vendor documentation.

Keep the username and access key outside source control. Do not commit them, paste them into a shared screenshot or log, or expose them in client-side code.

Set credentials as environment variables

Set the variables in your shell or deployment environment, rather than embedding credentials in the script. For example, in a POSIX-compatible shell:

export LT_USERNAME='your-lambdatest-username'
export LT_ACCESS_KEY='your-lambdatest-access-key'
node capture.js

Use your organization’s secret manager or CI/CD secret settings for deployed workloads. Avoid putting real credentials directly in a command if your shell history or process environment is accessible to other users.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Start a screenshot test from Node.js

The documented start route is POST https://api.lambdatest.com/screenshots/v1/. It uses HTTP Basic authentication and a JSON body; a successful response provides a test_id. The following complete script uses Node’s standard fetch interface to call that contract. It is an implementation example, not a Node sample published by LambdaTest. Refer to the Screenshot API reference for the current request schema.

const username = process.env.LT_USERNAME;
const accessKey = process.env.LT_ACCESS_KEY;

if (!username || !accessKey) {
  throw new Error('Set LT_USERNAME and LT_ACCESS_KEY');
}

const authorization = Buffer.from(`${username}:${accessKey}`).toString('base64');

const response = await fetch('https://api.lambdatest.com/screenshots/v1/', {
  method: 'POST',
  headers: {
    Authorization: `Basic ${authorization}`,
    'Content-Type': 'application/json',
    Accept: 'application/json',
  },
  body: JSON.stringify({
    url: 'https://example.com',
    defer_time: 0,
    email: false,
    win_res: '1366x768',
    configs: {
      // Add browser/OS configurations supported by your current account.
    },
  }),
});

if (!response.ok) {
  throw new Error(
    `Screenshot API returned HTTP ${response.status}: ${await response.text()}`,
  );
}

const result = await response.json();
if (!result.test_id) {
  throw new Error(`Screenshot API response did not include test_id: ${JSON.stringify(result)}`);
}

console.log(`Started screenshot test: ${result.test_id}`);

Save this as capture.js. The example uses top-level await, so run it as an ES module—for example, use a .mjs filename or set "type": "module" in package.json—and use a Node release that supports built-in fetch. If you use CommonJS or an older runtime, adapt the module syntax or use an HTTP client available to that project.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Choose browser and resolution settings deliberately

The request body’s url is the page to capture. The API reference also lists settings such as configs, win_res, mac_res, defer_time, email, callback_url, tunnel, and tunnel_identifier. Use the current API schema for accepted values and required relationships. The official setup examples include legacy browser versions, so do not copy them as a current compatibility matrix; check presently supported OS/browser combinations before hard-coding them.

  • Use the appropriate Windows or macOS resolution field for the configuration you intend to run, and verify the resolution format against the current reference.
  • Use defer_time only when the target needs time to render content after navigation; a delay can add waiting time and does not guarantee that every asynchronous element has finished loading.
  • For a private or local target, the reference exposes tunnel-related fields, but those fields alone are not a complete tunnel setup guide. Validate the current tunnel prerequisites and configuration separately.
  • If you provide a callback_url, confirm how your service receives and validates callbacks in the current API documentation. Otherwise, retrieve test details using the test ID.

Retrieve the test status and screenshot URLs

After receiving test_id, call GET https://api.lambdatest.com/screenshots/v1/{test_id} with the same Basic authentication. The details response can include test_status and a screenshots array with browser, operating system, resolution, status, and screenshot or thumbnail URLs. See the details endpoint reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
const testId = result.test_id;
const detailsResponse = await fetch(
  `https://api.lambdatest.com/screenshots/v1/${encodeURIComponent(testId)}`,
  {
    headers: {
      Authorization: `Basic ${authorization}`,
      Accept: 'application/json',
    },
  },
);

if (!detailsResponse.ok) {
  throw new Error(
    `Screenshot details returned HTTP ${detailsResponse.status}: ${await detailsResponse.text()}`,
  );
}

const details = await detailsResponse.json();
console.log('Test status:', details.test_status);
console.log('Screenshot records:', details.screenshots);

The API documentation establishes the details route but does not specify a polling interval or promise a completion time. If you need to poll, stop after a bounded number of attempts and increase the wait between requests rather than polling indefinitely. Handle a non-completed status as an in-progress result, and use a callback if that better fits your application and the current callback contract.

India-specific considerations

The documented endpoint, Basic authentication format, and environment-variable setup are presented as the general API workflow; the available official guidance does not identify a separate India endpoint, credential format, browser configuration, pricing rule, or account policy. If you are integrating from India, check that your account has access to the API and that your network egress and security policy allow the required outbound requests. Confirm current commercial terms and regional availability with your account rather than assuming a specific price or performance level.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common integration failures

  • Missing credential error: Check that both LT_USERNAME and LT_ACCESS_KEY are set in the environment of the Node process, and that the names match exactly.
  • Authentication failure: Confirm that the username and access key are the values for the account, that the Basic header encodes username:accessKey, and that no whitespace was added when storing either value. Do not print the encoded header or secrets in logs.
  • Non-2xx response from the start route: Read the response body for the API’s reported validation or authorization issue. Confirm the request is a JSON POST to the documented route, the content type is application/json, and the body matches the current schema.
  • No test_id in the response: Do not continue to the details route with an undefined identifier. Inspect the response shape and status, then correct the rejected request or handle any response form described by the current API reference.
  • Invalid or unavailable browser configuration: Replace legacy sample values with combinations currently supported for your account. The API’s examples should not be treated as a live support matrix.
  • Target page is inaccessible or incomplete: Check that the service can reach the URL, that it does not require a local-only network route, and that the page has enough time to render. If it is private or local, configure the currently documented tunnel workflow rather than relying only on tunnel fields in the request.
  • Details do not show completed screenshots yet: Treat the status as potentially in progress, use bounded retries with backoff, or configure a callback according to the current reference. The docs do not establish a guaranteed completion time.
  • fetch is undefined or top-level await fails: Check the Node.js release and module mode. Use a runtime with built-in fetch, or use a project-compatible HTTP client and module syntax.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. A single GET request can return an image or PDF; it also supports cross-browser-style viewport configuration and other capture controls. For a basic capture, the request returns the screenshot bytes directly.

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. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 screenshots. Sign up for ScreenshotNeo’s free plan.

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

Frequently Asked Questions

How do I set up the LambdaTest Screenshot API in Node.js?

Store your account username and access key in environment variables, send an authenticated JSON POST to the documented start route, and use the returned test_id to retrieve status and screenshot records. The article’s Node.js code implements that HTTP contract with fetch.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

How do I capture cross-browser screenshots with LambdaTest from Node.js?

Include the target URL and valid browser/OS configurations in the start-test JSON body, then retrieve the test details and screenshot records with the returned test_id. Select configurations from the current supported combinations rather than legacy examples.

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.