I'm trying to add specific flags of chrome (flags that are found in "chrome://flags/") to the running of my browser in the tests.
The flags I'm trying to enable are:
and to disable:
In the regular chrome command line it looks like this:
"--flag-switches-begin --enable-webgl-draft-extensions --enable-features=SharedArrayBuffer --disable-features=AsmJsToWebAssembly --flag-switches-end"
If i add these criteria in
puppeteer.launch({args});
I receive them before the "--flag-switches-begin" line (I'm watching the command that chrome was ran with in: "chrome://version").
Thank you very much!
Follow these steps, please.
puppeteer.defaultArgs()
will provide you all default flags. You this method to get them, then filter the array to remove flags that you want to.
https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerdefaultargs
const args = puppeteer.defaultArgs().filter(arg => arg !== '--enable-asm-webassembly')
Now, add some flags to the array.
args.push('--enable-webgl-draft-extensions', '--shared-array-buffer')
Enable ignoreDefaultArgs
flag when launch a new instance of browser. Also, provide the list of arguments we made above.
const browser = await puppeteer.launch({ ignoreDefaultArgs: true, args })
await puppeteer.launch({
args: [
'--disable-features=LookalikeUrlNavigationSuggestionsUI'
]
})
Try something like this.
You can launch Chromium, switch your flag and then go "chrome://version/", to see what has changed in the command line.
In my case, when i switch "Navigation suggestions for lookalike URLs" to disabled,relaunch Chrommium, then i found --disable-features=LookalikeUrlNavigationSuggestionsUI
in the command line。
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With