DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
Playwright

How to Take a Screenshot of a Website in Remix with Playwright

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.

To screenshot a website built with Remix, open its URL in a real browser controlled by Playwright, then call page.screenshot(). Remix serves the page and handles routes; Playwright renders the page in a browser and captures the result. For a normal viewport screenshot, use await page.screenshot({ path: "screenshot.png" }). Add fullPage: true for the whole scrollable page, or use a locator to capture one component.

What Remix does—and what takes the screenshot

A Remix route does not itself produce a browser screenshot. Remix handles the application URL, route matching, and response; Playwright opens that URL in a browser, waits for the page to render, and captures what the browser displays. That distinction matters whether you are saving a screenshot locally, checking a page during development, or building a capture workflow.

Remix route and controller handlers use the standard Web Response model. A route could be part of a design that returns an image, but it would not eliminate the need to run browser capture somewhere. A server-side screenshot endpoint therefore needs browser automation infrastructure in addition to the Remix route that receives a request and returns a response.

There is also a framework-version distinction to check before following framework-specific setup guidance: the Remix documentation landing page currently directs developers to React Router v7 for the latest framework features. If your application uses a legacy Remix release, follow documentation for the version you actually have installed rather than assuming the latest React Router instructions apply unchanged.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Capture a Remix page with Playwright

The example below assumes Playwright is installed in the project and its Chromium browser is available in the execution environment. Start your Remix app separately, then run the capture script in a Node.js environment. Replace the URL with the route you want to capture.

import { chromium } from "playwright";

const browser = await chromium.launch();
try {
  const page = await browser.newPage();
  await page.goto("http://localhost:3000");
  await page.screenshot({ path: "screenshot.png" });
} finally {
  await browser.close();
}

This saves a PNG of the browser’s current viewport to screenshot.png. The URL must be reachable from the process running Playwright: localhost refers to that machine or container, not necessarily your laptop when the script runs in a remote CI job or hosted environment. Make sure the app is already running and that the chosen route is the one you intend to capture.

The try/finally ensures the browser is closed even if navigation or capture fails. For repeated captures in one process, you can keep a browser open and create separate pages as needed, then close the browser when the work is finished.

Choose the capture scope and output

Playwright supports a viewport screenshot, a full-page screenshot, a screenshot of one element, and image bytes returned to the script. Select the form that matches what you need rather than capturing a full page by default.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
What to capture Playwright call Result
Visible viewport await page.screenshot({ path: "page.png" }) The page area currently visible in the browser viewport.
Entire scrollable document await page.screenshot({ path: "full-page.png", fullPage: true }) A capture extending beyond the visible fold to include the scrollable page.
One component await page.locator(".target").screenshot({ path: "component.png" }) The rendered area of the element matching the CSS selector.
Image bytes for further processing const bytes = await page.screenshot() A buffer your script can pass to another operation instead of writing a file at capture time.

Capture a full page

Use fullPage: true when the output should include content below the initial viewport. This captures the scrollable document rather than requiring you to stitch together screenshots manually.

await page.goto("http://localhost:3000/products");
await page.screenshot({ path: "products-full.png", fullPage: true });

Capture one element

A locator screenshot is useful when a page contains a particular card, chart, or other component you want to save without the surrounding layout. The selector must match the intended element on the rendered page.

await page.goto("http://localhost:3000");
await page.locator(".target").screenshot({ path: "component.png" });

Replace .target with a selector from your page, such as a class or other valid CSS selector. If the selector does not identify an element, there is no component to capture; inspect the rendered page and correct the selector.

Keep the image in memory

When you want to process, upload, or otherwise pass the image along in your code, omit path. Playwright returns the screenshot as bytes rather than saving it directly to a file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const bytes = await page.screenshot();
// Pass bytes to the next operation in your application.

Choose an image format and resolution

Playwright’s screenshot API supports PNG, JPEG, and WebP output. The file extension in the examples controls the format when saving to a path: use, for example, .png, .jpeg, or .webp. Pick the format expected by the next part of your workflow.

Screenshot scale determines whether the output is based on CSS pixels or device pixels. CSS-pixel scale can keep an image smaller on high-density screens; device-pixel scale captures at higher resolution. The suitable choice depends on whether you prioritize a more compact image or extra pixel detail. Consult the API for your installed Playwright version for the exact option spelling and behavior; avoid assuming a screenshot’s pixel dimensions are the same as its CSS layout dimensions.

Make captures representative of the page

A browser screenshot records a rendered page, not just the route source. The page needs to be reachable, and the browser must be able to render it. For Remix applications, that means capturing the URL and route in the same conditions relevant to your task—for example, the correct local or deployed origin and the page state you actually want to inspect.

  • Use the intended URL. A root URL and a nested Remix route can display different content. Navigate directly to the route being documented or checked.
  • Pick the scope first. A viewport capture is not a full-document capture. Set fullPage: true only when content beyond the fold belongs in the output.
  • Target components deliberately. A locator screenshot focuses on the matched element, so verify the selector against the rendered page.
  • Match output handling to the next step. Use a file path for a saved artifact or returned bytes when another operation will consume the image.
  • Run the browser where the URL is reachable. A URL that works on a developer’s machine may not resolve from a separate CI runner or server.

These choices are separate from visual testing. Taking a screenshot gives you an image; it does not, by itself, compare the image with an expected result or declare a test passed or failed. If repeatable visual tests are the goal, treat comparison and assertions as an additional testing workflow.

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

When a Remix route needs to return a screenshot

If you want a URL in your application to return an image rather than merely save one from a script, treat that as a separate server-side design. The route layer can return a Web Response, but browser capture still has to run in suitable browser automation infrastructure. The route and the browser automation have different jobs: one handles the HTTP request and response; the other renders the target page and creates the image.

Do not assume that putting a page.screenshot() call in a route handler automatically makes a viable capture service. The browser has to be available to the process, and the target URL must be reachable from that process. The reviewed Remix documentation does not establish a built-in screenshot endpoint, nor a universal deployment recipe or compatibility matrix for every Remix release, runtime, browser, CI system, or host. Check the requirements for your pinned Playwright version and the environment where capture will run.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common capture problems

The browser does not launch

The example requires Playwright and an available Chromium browser. Confirm both are installed and supported in the environment running the script. A development machine and a deployment host may have different browser availability, so validate capture in the environment where it will actually run.

The capture is blank or shows the wrong page

Check the URL passed to page.goto(), and confirm the Remix app is running and reachable from the Playwright process. If capture runs remotely, do not assume that localhost points to the machine where you started the app. Navigate to the exact route you want rather than relying on a different route to lead there.

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

The screenshot stops at the fold

The default page screenshot captures the viewport. Set fullPage: true to include the scrollable document. If only one component is required, use a locator screenshot instead of capturing and later cropping the whole page.

The component image is not the expected element

Check that the CSS selector passed to page.locator() identifies the intended element in the rendered route. A selector that is valid in another part of the application may not match this page.

The script exits without closing the browser

Keep browser shutdown in a finally block, as in the complete example. That closes the browser after both successful captures and errors during navigation or screenshot generation.

Or skip the browser setup

If you need a hosted screenshot instead of running browser automation yourself, ScreenshotNeo takes screenshots through a single GET request. The API can return PNG, JPEG, or WebP images or a PDF; see the ScreenshotNeo API documentation for its parameters. For example, save a screenshot of a Remix route like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://your-site.example/your-route -o shot.webp

Use the URL of the running Remix route you want to capture. ScreenshotNeo removes known cookie-consent banners, newsletter popups, and chat widgets before capture; each of those cleanup steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

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 the free plan to try the API.

Frequently Asked Questions

Can I take a screenshot of a Remix website without deploying it?

Yes. Start the app locally and point Playwright at a local URL that the browser process can reach, such as the localhost URL in the example.

Does taking a screenshot automatically test that my page looks correct?

No. It creates an image. Comparing that image with an expected result is a separate visual-testing step.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.