Downscaled screenshots capture the wrong region after scrolling

Author: ddussiCreated Sep 7, 2026Updated Sep 16, 2026
Labelsconfirmed

Description of the bug

When --screenshot-max-width or --screenshot-max-height causes a screenshot to be downscaled, take_screenshot captures the top-left of the document instead of the current viewport after scrolling. Element screenshots using uid are also offset by the page's scroll position.

The screenshot can therefore show an unrelated area when debugging a scrolled page.

Reproduction

Start the server with the configuration below, then:

  1. Call new_page with url: "about:blank". Use the returned page ID for the following page-scoped calls.

  2. Call emulate with viewport: "800x600x1".

  3. Call evaluate_script with this function:

    () => {
      document.body.style.margin = '0';
      document.body.innerHTML = `
        <div style="height:1000px;background:red"></div>
        <div style="height:1000px;background:blue"></div>
      `;
      window.scrollTo(0, 1000);
      return {scrollY: window.scrollY};
    }
    
  4. Call take_screenshot with the page ID and otherwise default parameters.

Actual: the returned 200×150 image is red, although the current viewport is blue. Removing the screenshot size limit returns the correct blue viewport.

Separate checks on left-to-right pages reproduced the issue with horizontal scrolling, without viewport emulation, and with element screenshots using uid. Full-page screenshots captured the correct region in those checks.

Expectation

The screenshot should show the same region with or without the size limit. In this example, it should be a blue 200×150 image.

The configuration reference describes the size limits as downscaling the captured image while preserving its aspect ratio. The tool reference distinguishes full-page capture from the currently visible viewport.

For viewport and element screenshots, the downscale path passes viewport-relative coordinates from getSourceBox() to page.screenshot({clip}), which needs document coordinates. The page scroll offset is missing.

Related: #2380 fixed downscaling without an emulated viewport, and #2536 fixed the size bound on HiDPI displays. This report concerns the captured region after scrolling.

MCP configuration

{
  "mcpServers": {
    "chrome-devtools": {
      "command": "npx",
      "args": [
        "-y",
        "[email protected]",
        "--headless",
        "--isolated",
        "--screenshot-max-width",
        "200",
        "--no-usage-statistics"
      ]
    }
  }
}

Chrome DevTools MCP version

1.8.0 (npm package); also reproduced on main at dc1d55930afc8c75c7d06082c3cfcf5b3ab3c7f8.

Chrome version

Chrome for Testing 152.0.7977.75, selected with --executable-path in the reproduction harness.

Coding agent version

Standalone MCP client using @modelcontextprotocol/sdk 1.30.0.

Model version

No response

Chat log

No response

Node version

v24.12.0

Operating system

macOS

Extra checklist

  • I want to provide a PR to fix this bug

Source: ChromeDevTools/chrome-devtools-mcp