mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat(Launcher): allow the default arguments to be overridden (#1623)
This patch: - adds `puppeteer.defaultArgs()` method to get default arguments that are used to launch chrome - adds `ignoreDefaultArgs` option to `puppeteer.launch` to avoid using default puppeteer arguments Fixes #872
This commit is contained in:
committed by
Andrey Lushnikov
parent
f8040cb2a2
commit
8a40cd5eef
@@ -61,10 +61,13 @@ class Launcher {
|
||||
static async launch(options) {
|
||||
options = Object.assign({}, options || {});
|
||||
let temporaryUserDataDir = null;
|
||||
const chromeArguments = [].concat(DEFAULT_ARGS);
|
||||
const chromeArguments = [];
|
||||
if (!options.ignoreDefaultArgs)
|
||||
chromeArguments.push(...DEFAULT_ARGS);
|
||||
|
||||
if (options.appMode)
|
||||
options.headless = false;
|
||||
else
|
||||
else if (!options.ignoreDefaultArgs)
|
||||
chromeArguments.push(...AUTOMATION_ARGS);
|
||||
|
||||
if (!options.args || !options.args.some(arg => arg.startsWith('--user-data-dir'))) {
|
||||
@@ -172,6 +175,13 @@ class Launcher {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {!Array<string>}
|
||||
*/
|
||||
static defaultArgs() {
|
||||
return DEFAULT_ARGS.concat(AUTOMATION_ARGS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user