Headless mode should not force --hide-scrollbars
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.17.0
- Platform / OS version: macOS / CI (linux)
- Node.js version: 10.16.0
What steps will reproduce the problem?
Please include code that reproduces the issue.
- Create a page with a block level element and measure its width
- Increase the element height so the page shows the scrollbars
- Measure the element’s width again
What is the expected result?
The element’s width differs because the scrollbar makes it shrink
What happens instead?
The element’s width doesn’t change. This is because Puppeteer in headless
modes hides the scrollbars. https://github.com/GoogleChrome/puppeteer/blob/f5bb333cd0c42306f47e7767e5cb8b78af557c27/lib/Launcher.js#L85
AFAIK at the moment there is no way to override this behavior.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:7
Top Results From Across the Web
Chrome headless puppeteer: make screenshot render scrollbar
Headless mode should not force --hide-scrollbars. The quick solution to ensure that scrollbars were rendered, both on our CI with headless ...
Read more >Using CSS to hide scrollbars without impacting scrolling
This guide will show you how to hide the scrollbar in several popular ... While it's common practice not to mess with default...
Read more >Getting Started with Headless Chrome - Chrome Developers
A headless browser is a great tool for automated testing and server environments where you don't need a visible UI shell. For example,...
Read more >How To Hide Scrollbars With CSS - W3Schools
It is not possible to scroll inside the page. Tip: To learn more about the overflow property, go to our CSS Overflow Tutorial...
Read more >hide-scrollbars doesn't work anymore after Target.createTarget
1. run chrome with "--headless --no-sandbox --disable-gpu ... b) --hide-scrollbars should set the default value of the hide_scrollbars ...
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 FreeTop 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
Top GitHub Comments
With a bit of Googling I found out you can override the default behaviour so you do see scrollbars in headless mode. Just add
ignoreDefaultArgs: ["--hide-scrollbars"]
to your puppeteer configuration:Code copied from here: https://github.com/GoogleChrome/puppeteer/issues/2999#issuecomment-490854398
+1 the default set-up should be the same as a non-headless mode = i.e. either display the scrollbars or hide the scrollbars on both. But currently,
headless: true,
will hide scrollbars whileheadless: false
will show scrollbars. Giving different test results based on wether it’s headless or not.