mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(launcher): support relative userDataDir on headless Windows (#6506)
Launching headless with a relative `userDataDir` hangs on Windows. Fix by calling `path.resolve` (idempotent) to add an absolute path instead in `defaultArgs`. Issues: #3453
This commit is contained in:
parent
8fabe32800
commit
f3086d7c97
@ -189,7 +189,8 @@ class ChromeLauncher implements ProductLauncher {
|
|||||||
args = [],
|
args = [],
|
||||||
userDataDir = null,
|
userDataDir = null,
|
||||||
} = options;
|
} = options;
|
||||||
if (userDataDir) chromeArguments.push(`--user-data-dir=${userDataDir}`);
|
if (userDataDir)
|
||||||
|
chromeArguments.push(`--user-data-dir=${path.resolve(userDataDir)}`);
|
||||||
if (devtools) chromeArguments.push('--auto-open-devtools-for-tabs');
|
if (devtools) chromeArguments.push('--auto-open-devtools-for-tabs');
|
||||||
if (headless) {
|
if (headless) {
|
||||||
chromeArguments.push('--headless', '--hide-scrollbars', '--mute-audio');
|
chromeArguments.push('--headless', '--hide-scrollbars', '--mute-audio');
|
||||||
|
@ -306,7 +306,7 @@ describe('Launcher specs', function () {
|
|||||||
'--headless'
|
'--headless'
|
||||||
);
|
);
|
||||||
expect(puppeteer.defaultArgs({ userDataDir: 'foo' })).toContain(
|
expect(puppeteer.defaultArgs({ userDataDir: 'foo' })).toContain(
|
||||||
'--user-data-dir=foo'
|
`--user-data-dir=${path.resolve('foo')}`
|
||||||
);
|
);
|
||||||
} else if (isFirefox) {
|
} else if (isFirefox) {
|
||||||
expect(puppeteer.defaultArgs()).toContain('--headless');
|
expect(puppeteer.defaultArgs()).toContain('--headless');
|
||||||
@ -330,7 +330,7 @@ describe('Launcher specs', function () {
|
|||||||
'-profile'
|
'-profile'
|
||||||
);
|
);
|
||||||
expect(puppeteer.defaultArgs({ userDataDir: 'foo' })).toContain(
|
expect(puppeteer.defaultArgs({ userDataDir: 'foo' })).toContain(
|
||||||
'foo'
|
path.resolve('foo')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user