Description
openedon Mar 10, 2021
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.
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)';
});