chrome-devtools-mcp icon indicating copy to clipboard operation
chrome-devtools-mcp copied to clipboard

resize_page fails with Protocol error: Browser.setContentsSize wasn't found

Open Platano78 opened this issue 1 month ago • 4 comments

Description

When calling resize_page to test mobile viewports, the command fails with a protocol error.

Error Message

Protocol error (Browser.setContentsSize): 'Browser.setContentsSize' wasn't found

Environment

  • Chrome DevTools MCP version: Latest (installed via Claude Code)
  • Chrome version: Unknown (remote debugging)
  • Platform: Linux (WSL2)
  • Claude Code: CLI

Steps to Reproduce

  1. Navigate to any page using navigate_page
  2. Call resize_page with mobile dimensions:
resize_page(width=414, height=896)
  1. Observe protocol error

Expected Behavior

Page viewport should resize to specified dimensions for mobile testing.

Actual Behavior

Command fails with Browser.setContentsSize not found error.

Workaround

Currently using emulate for CPU/network throttling, but cannot test mobile viewport sizes.

Additional Context

This appears to be a Chrome DevTools Protocol compatibility issue - Browser.setContentsSize may not be available in all Chrome versions or may have been deprecated.


Filed from Claude Code session

Platano78 avatar Dec 05 '25 16:12 Platano78

Could you please provide the Chrome version you are using?

OrKoN avatar Dec 08 '25 08:12 OrKoN

Thanks for the quick response, @OrKoN!

Chrome Version: Google Chrome 139.0.7258.138 (running via remote debugging on Linux/WSL2)

Additional Context:

I see PR #650 addresses this by switching from Browser.setContentsSize to page.setViewport - that's exactly what's needed! The Browser.setContentsSize method appears to be unavailable in Chrome 139, which aligns with the protocol error.

Environment Details:

  • OS: Linux (WSL2) - Linux 6.6.87.2-microsoft-standard-WSL2
  • Chrome Version: 139.0.7258.138
  • Interface: Claude Code CLI
  • Chrome DevTools MCP: Latest version (as of Dec 5, 2025)
  • Remote Debugging: Yes (Chrome launched with --remote-debugging-port)

Workaround (Temporary): Until PR #650 is merged, I've been using the emulate function for basic mobile viewport testing, though it's not as clean as a dedicated resize_page function.

Testing Offer: Once PR #650 is merged, I'm happy to test the fix in my environment (WSL2 + remote debugging) to confirm it resolves the issue.

Thanks for the quick turnaround on this! 🙏

Platano78 avatar Dec 09 '25 15:12 Platano78

Update: I see PR #650 was closed without merging, as you prefer to keep using resize to avoid viewport/window size mismatches.

Given that Browser.setContentsSize appears to be unavailable in Chrome 139 (and possibly other versions), what would be the recommended approach to fix this?

Potential solutions:

  1. Feature detection: Check if Browser.setContentsSize is available before calling it, and provide a helpful error message if not
  2. Alternative CDP method: Is there a different Chrome DevTools Protocol method that achieves the same window resizing without the viewport rendering issues?
  3. Chrome version requirements: Should the tool document minimum/maximum Chrome versions where resize_page is expected to work?

Happy to help test any proposed solutions in my Chrome 139 + WSL2 environment. Let me know how you'd like to proceed!

Platano78 avatar Dec 09 '25 15:12 Platano78

Per https://github.com/ChromeDevTools/chrome-devtools-mcp we support only the current stable Chrome version which is Chrome 143 so I would recommend upgrading to a supported version.

OrKoN avatar Dec 09 '25 16:12 OrKoN