question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hide/remove Elements from Screenshots

See original GitHub issue

Discussed in https://github.com/microsoft/playwright/discussions/5068

<div type='discussions-op-text'>

Originally posted by rollin-cogers January 20, 2021 Hey everyone! I’ve been very excited to use this tool for testing, as I’ve previously been using protractor for all my testing.

In the past I’ve used modules like webdriver-image-comparison that allow for options like hiding and removing elements from a screenshot by adding visibility: hidden or display: none to the styling for the passed elements.

Is this a feature that we might see in the future with playwright? Would anyone else benefit from the ability to exclude elements from screenshots?

I would love to see something like this:

page.screenshot({fullpage: true, hideElements: ['div.dynamic_content', 'div#profilePicture']})
```</div>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:27
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
aslushnikovcommented, Feb 9, 2022

Everybody: So far we’re considering adding the blackout option to the screenshot:

await page.screenshot({
  blackout: [
    page.locator('.my-dynamic-element'), 
    page.locator('.some-video'), 
  ],
});

Let us know if it will or will not work for you!

4reactions
p01commented, Feb 9, 2022

Perfect! The only objection is about the term blackout. Let’s change for something more generic e.g. hide, or hideElements

Read more comments on GitHub >

github_iconTop Results From Across the Web

hide/remove Elements from Screenshots · Issue #10326 ...
I've been very excited to use this tool for testing, as I've previously been using protractor for all my testing. In the past...
Read more >
Hide or remove objects with Content-Aware Fill - Adobe Support
Remove objects with Content-Aware Fill · Select the Object Selection tool in the Toolbar and drag a loose rectangle or lasso around the...
Read more >
Hide Sensitive Information in an Image | Snagit - TechSmith
Hide Sensitive Information in an Image. Snagit has several tools that allow you to remove, replace, or hide parts of a screenshot that...
Read more >
Disable UI element image, delete all UI images
Solved: Hi, PAD takes a screenshot of each UI element we capture - is there a way to disable it entirely or at...
Read more >
How to remove certain elements before taking screenshot?
One way I thought was to clone the element and then remove the elements, but taking a screenshot of the clone gives a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found