Some chrome flags not working in headless mode
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.11.0
- Platform / OS version: Windows 7/10
- URLs (if applicable):
- Node.js version: 10.14.1
What steps will reproduce the problem?
'use strict';
const URL = 'https://www.allaboutwomen.in/sitemap.xml';
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({
headless: true,
ignoreHTTPSErrors: true,
args: ['--disable-web-security', '--allow-running-insecure-content']
});
const page = await browser.newPage();
await page.on('response', response => {
const url = response.url();
if (!url.startsWith('data:') && response.ok) {
response.buffer().then(
b => {
console.log(`${response.status()} ${url} ${b.length} bytes`);
},
e => {
console.error(`${response.status()} ${url} failed: ${e}`);
}
);
}
});
await page.goto(URL);
})();
What is the expected result?
With headless: false
the result is:
200 https://www.allaboutwomen.in/sitemap.xml 5398333 bytes
200 https://carzoom.in/wp-content/plugins/google-sitemap-generator/sitemap.xsl 6608 bytes
200 https://www.allaboutwomen.in/favicon.ico 0 bytes
What happens instead?
With headless: true
the result is:
200 https://www.allaboutwomen.in/sitemap.xml 5398333 bytes
http://carzoom.in/wp-content/plugins/google-sitemap-generator/sitemap.xsl URL status is blocked: origin
which is legit but --disable-web-security
doesn’t work. When --disable-web-security
works (with headless: false
) the same URL status is then blocked: mixed-content
which is still legit but --allow-running-insecure-content
flag doesn’t work to disable it.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:15
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Flags don't work when running headless? - Google Groups
Most prefs flags are not implemented in headless Chrome. If your test needs prefs flags, most likely you'll need to run it with...
Read more >Angular e2e tests protractor chrome flags not working headless
I am trying to set the cookies-without-same-site-must-be-secure@2 in my protractor config, it works perfectly, when not running headless. But ...
Read more >Getting Started with Headless Chrome - Chrome Developers
In some cases, you may not need to programmatically script Headless Chrome. There are some useful command line flags to perform common tasks ......
Read more >Running Selenium Headless with Chrome - Linux Hint
In some cases, it may fail to do so. In that case, Selenium may not be able to run the Google Chrome web...
Read more >The Beginner's Guide to Chrome Headless
Headless Chrome isn't a different channel. It's a different way to run the same application. Later in this post you'll find out how...
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
@dhijn the best we have is the source code:
//content
switches://content/public/common/content_switches.h
//headless
switches://headless/app/headless_shell_switches.h
If you’re comfortable with https://cs.chromium.org, than you can search for the flag and see where it is used. If it lives somewhere under
//chrome
, than it’s Chromium-only.crbug: https://crbug.com/1352473