Different behavior between { headless: false } and { headless: true }
See original GitHub issueI’m curious to know what changes there are between running as headless true vs false. When I run a login to Amazon using headless: true
I get an error from Amazon via the screenshot. But when I set headless: false
I watch it work just fine, no error.
So I’m trying to figure out what headless: true
is doing that is different from when it’s not headless.
Thanks to any suggestions.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:78
- Comments:53 (7 by maintainers)
Top Results From Across the Web
Why does headless need to be false for Puppeteer to work?
The reason it might work in UI mode but not headless is that sites who aggressively fight scraping will detect that you are...
Read more >The Java Headless Mode - Baeldung
If the environment is actually headless, the JVM would be aware of it implicitly. However, there will be subtle differences in some ......
Read more >Puppeteer - Non Headless Execution - Tutorialspoint
By default, Puppeteer executes the test in headless Chromium. This means if we are running a test using Puppeteer, then we won't be...
Read more >Detecting Headless Chrome: Puppeteer-Extra-Plugin-Stealth
Under the hood, headless browsers behave just like other browsers. ... to distinguish between a genuine Chrome browser used by humans and ...
Read more >pyppeteer headless=false - Unisa
The headless browser will behave as a 'normal' user and scrolls to the bottom of ... Different behavior between { headless: false }...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
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
As mentioned in the article @Garbee posted the headless version does not have languages set on the navigator object.
Note also that the headless version will not have languages set in its Accept-Language Header. Some sites (ASP.NET in my experience) require this header to be set. Other sites are looking for this header specifically to identify headless browsers.
I copied the value from an example request generated by my normal chrome install. There is probably a more minimal setting for this header that works.
For what it’s worth I’ve also found that adding the following user agents override can help smooth over differences in some cases:
The UA I’ve provided is just an example. You can use any valid UA that matches an existing browser.