Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(chromium): allow passing --remote-debugging-port for debugging (#1857)

Pavel Feldman022bc67c0715
diff --git a/src/server/chromium.ts b/src/server/chromium.ts
index 43c238b2ae..eefd77b801 100644
--- a/src/server/chromium.ts
+++ b/src/server/chromium.ts
@@ -149,7 +149,7 @@ export class Chromium implements BrowserType<CRBrowser> {
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');
- if (args.find(arg => arg.startsWith('--remote-debugging-')))
+ if (args.find(arg => arg.startsWith('--remote-debugging-pipe')))
throw new Error('Playwright manages remote debugging connection itself.');
if (launchType !== 'persistent' && args.find(arg => !arg.startsWith('-')))
throw new Error('Arguments can not specify page to be opened');
diff --git a/test/chromium/launcher.spec.js b/test/chromium/launcher.spec.js
index 337472cfea..3c41f3df48 100644
--- a/test/chromium/launcher.spec.js
+++ b/test/chromium/launcher.spec.js
@@ -26,11 +26,11 @@ describe('launcher', function() {
const error = await browserType.launchServer(options).catch(e => e);
expect(error.message).toContain('Playwright manages remote debugging connection itself');
});
- it('should throw with remote-debugging-port argument', async({browserType, defaultBrowserOptions}) => {
+ it('should not throw with remote-debugging-port argument', async({browserType, defaultBrowserOptions}) => {
const options = Object.assign({}, defaultBrowserOptions);
- options.args = ['--remote-debugging-port=9222'].concat(options.args || []);
- const error = await browserType.launchServer(options).catch(e => e);
- expect(error.message).toContain('Playwright manages remote debugging connection itself');
+ options.args = ['--remote-debugging-port=0'].concat(options.args || []);
+ const browser = await browserType.launchServer(options);
+ await browser.close();
});
it('should open devtools when "devtools: true" option is given', async({browserType, defaultBrowserOptions}) => {
const browser = await browserType.launch(Object.assign({devtools: true}, {...defaultBrowserOptions, headless: false}));