Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/server/chromium/chromium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class Chromium extends BrowserType {
const { args = [], proxy } = options;
const userDataDirArg = args.find(arg => arg.startsWith('--user-data-dir'));
if (userDataDirArg)
throw new Error('Pass userDataDir parameter instead of specifying --user-data-dir argument');
throw new Error('Pass userDataDir parameter to `browserType.launchPersistentContext(userDataDir, ...)` instead of specifying --user-data-dir argument');
if (args.find(arg => arg.startsWith('--remote-debugging-pipe')))
throw new Error('Playwright manages remote debugging connection itself.');
if (args.find(arg => !arg.startsWith('-')))
Expand Down
2 changes: 1 addition & 1 deletion src/server/firefox/firefox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class Firefox extends BrowserType {
console.warn('devtools parameter is not supported as a launch argument in Firefox. You can launch the devtools window manually.');
const userDataDirArg = args.find(arg => arg.startsWith('-profile') || arg.startsWith('--profile'));
if (userDataDirArg)
throw new Error('Pass userDataDir parameter instead of specifying -profile argument');
throw new Error('Pass userDataDir parameter to `browserType.launchPersistentContext(userDataDir, ...)` instead of specifying --profile argument');
if (args.find(arg => arg.startsWith('-juggler')))
throw new Error('Use the port parameter instead of -juggler argument');
const firefoxUserPrefs = isPersistent ? undefined : options.firefoxUserPrefs;
Expand Down
4 changes: 2 additions & 2 deletions src/server/webkit/webkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export class WebKit extends BrowserType {
const { args = [], proxy, devtools, headless } = options;
if (devtools)
console.warn('devtools parameter as a launch argument in WebKit is not supported. Also starting Web Inspector manually will terminate the execution in WebKit.');
const userDataDirArg = args.find(arg => arg.startsWith('--user-data-dir='));
const userDataDirArg = args.find(arg => arg.startsWith('--user-data-dir'));
if (userDataDirArg)
throw new Error('Pass userDataDir parameter instead of specifying --user-data-dir argument');
throw new Error('Pass userDataDir parameter to `browserType.launchPersistentContext(userDataDir, ...)` instead of specifying --user-data-dir argument');
if (args.find(arg => !arg.startsWith('-')))
throw new Error('Arguments can not specify page to be opened');
const webkitArguments = ['--inspector-pipe'];
Expand Down
7 changes: 7 additions & 0 deletions test/browsertype-launch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ it('should throw if userDataDir option is passed', async ({browserType, browserO
expect(waitError.message).toContain('userDataDir option is not supported in `browserType.launch`. Use `browserType.launchPersistentContext` instead');
});

it('should throw if userDataDir is passed as an argument', async ({browserType, browserOptions}) => {
let waitError = null;
const options = Object.assign({}, browserOptions, {args: ['--user-data-dir=random-path', '--profile=random-path']});
await browserType.launch(options).catch(e => waitError = e);
expect(waitError.message).toContain('Pass userDataDir parameter to `browserType.launchPersistentContext');
});

it('should throw if port option is passed', async ({browserType, browserOptions}) => {
const options = Object.assign({}, browserOptions, {port: 1234});
const error = await browserType.launch(options).catch(e => e);
Expand Down