[Question] Way for capturing screenshot with `:visited` style?
See original GitHub issueDescription
Serve HTML on http://localhost:3000/index.html
:
<style>
a:visited { color: red }
</style>
<a id="visited" href="/visited.html">Visited</a>
<a id="not-visited" href="/not-visited.html">Not Visited</a>
And run:
await page.goto("http://localhost:3000/index.html");
await page.click(`a#visited`);
await page.goBack();
await page.screenshot({ path: "./screenshot.png" });
Then, screenshot.png:
Expected (captured by hand operation):
Why :visited
styles are ignored?
For privacy reason.
To prevent history leaking, window.getComputedStyle
return a lie property.
Ref:
- https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector
- https://dbaron.org/mozilla/visited-privacy
- https://github.com/progfay/visited-pseudo-history-leaking/blob/main/overview.md
Question
Is there any way to capturing screenshot with :visited
style?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
4 Kinds of Screenshots You Need to Start Using Immediately
Screenshots, screen captures, and screen recordings all seem the same, but are they? Learn the key differences and how why they matter to...
Read more >Screen Capture - Qualtrics
The screen capture question allows respondents to attach a screenshot of the site they are viewing when taking a survey through Website Feedback....
Read more >Take a screen capture and use it as an image in an email
Take a screenshot on a Mac · Shift-Command (⌘)-4 on your keyboard to select the area you want to take a screenshot of....
Read more >Any way to enable full styling of :visited links in firefox?
No, you cannot do that. See styling restrictions for :visited : For privacy reasons, browsers strictly limit which styles you can apply ...
Read more >visited - CSS: Cascading Style Sheets - MDN Web Docs
The :visited CSS pseudo-class applies once the link has been visited by the user. For privacy reasons, the styles that can be modified...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Why was this issue closed?
We are prioritizing the features based on the upvotes, recency and activity in the issue thread. It looks like this issue only has a handful of upvotes, has not been touched recently and/or we lack sufficient feedback to act on it. We are closing issues like this one to keep our bug database maintainable. Please feel free to open a new issue and link this one to it if you think this is a mistake.
I think we are missing this feature, so it can be considered a Playwright bug. Let me start collecting upvotes for it.