Skip to content

[Docs]: Fix parameter name for element screenshots in browser_take_screenshot MCP Tool #42517

Description

Page(s)

https://playwright.dev/mcp/tools/screenshots
https://playwright.dev/mcp/tools/screenshots#element-screenshot

Description

Summary

The documentation for browser_take_screenshot incorrectly lists ref as the parameter to capture a screenshot of a specific element. However, the actual JSON schema and implementation of @playwright/mcp expect the parameter name target.

Issue

When passing { ref: "e12" } as shown in the documentation, @playwright/mcp does not recognize ref, causing it to ignore the argument and default to capturing the full viewport instead of cropping to the specified element.

Proposed Changes

  1. In the browser_take_screenshot parameters table, change ref to target:
Parameter Type Required Description
type string no png (default), jpeg, or webp
target string no Exact target element reference (ref) from page snapshot or unique element selector
fullPage boolean no Capture full scrollable page
  1. Update the Element screenshot example:
You: Take a screenshot of just the login form.
→ browser_take_screenshot { target: "e12" }
→ Returns: PNG image cropped to the element

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions