Skip to content

✨ Add support for taking screenshots of specific elements #23

@twocaretcat

Description

@twocaretcat

Is This New?

  • I have read all available documentation (ex. README.md, CONTRIBUTING.md, external docs site, etc.)
  • I have searched for existing issues
  • I'm willing to implement this myself (optional)

What?

Add support for generating screenshots of specific elements rather than the whole page.

In the screenshot config, expose a property that allows users to provide a CSS selector. If provided, use this CSS selector to get a specific element using Locators and call the screenshot method on it instead.

Ensure errors are handled properly since there will be cases where the element doesn't exist, syntax is invalid, etc.

Why?

Puppeteer also supports taking screenshots of individual elements with ElementHandle.screenshot(). Users may want to take screenshots of elements rather than the whole page when showcasing components in documentation, cropping pages, etc.

Alternatives

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⏳ 5EFFORT: An issue requiring a high effort✨ featureTYPE: An enhancement or a new feature🚦 readySTATUS: An issue that have been reproduced, reviewed, estimated, and is ready to be worked on🚩 lowPRIORITY: An issue that is not urgent

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions