Skip to content

[Question]/[Feature Request] Taking a screenshot of the element without shadow #5779

Closed

Description

I have an issue with creating a screenshot of the element. The element has a shadow and when PW creates a screenshot, it takes it with a shadow. The issue here is that shadow is translucent and data behind the shadow can be different from run to run (it's okay). I use such screenshots for screenshots comparison - checking that test screenshot is equal (with some precision) to reference screenshot. But because of data behind the shadow it's not always true. Is there any way to take screenshot of the element without shadow? If there is no way, can it become a feature request?

Adding a couple of pics for better understanding.
image

image

As a workaround I change shadow to completely black before taking a screenshot. And it works. I also tried to set boxShadow = 'none', but it did not help.

await element.evaluate(e => {
        e.style.boxShadow =
          '0px 2px 4px -1px rgb(0 0 0), 0px 4px 5px 0px rgb(0 0 0), 0px 1px 10px 0px rgb(0 0 0)';
      });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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