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.

Some chrome flags not working in headless mode

See original GitHub issue

Steps 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:closed
  • Created 5 years ago
  • Reactions:15
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aslushnikovcommented, Jan 10, 2019

@dhijn the best we have is the source code:

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.

0reactions
sohaib17commented, Nov 10, 2022
Read more comments on GitHub >

github_iconTop 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 >

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