Skip to content

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

fix(install): speculative fix for generateChromiumProtocol (#1583)

Dmitry Gozman6503c8330215
diff --git a/utils/protocol-types-generator/index.js b/utils/protocol-types-generator/index.js
index 49baff9eb1..645207cc67 100644
--- a/utils/protocol-types-generator/index.js
+++ b/utils/protocol-types-generator/index.js
@@ -9,9 +9,13 @@ const util = require('util');
async function generateChromiumProtocol(executablePath) {
const outputPath = path.join(__dirname, '..', '..', 'src', 'chromium', 'protocol.ts');
const playwright = await require('../../index').chromium;
- const args = playwright._defaultArgs();
- args.push('--remote-debugging-port=9339');
- const browser = await playwright.launch({ executablePath, args, ignoreDefaultArgs: true });
+ const defaultArgs = playwright._defaultArgs.bind(playwright);
+ playwright._defaultArgs = (...args) => {
+ const result = defaultArgs(...args);
+ result.push('--remote-debugging-port=9339');
+ return result;
+ };
+ const browser = await playwright.launch({ executablePath });
const page = await browser.newPage();
await page.goto(`http://localhost:9339/json/protocol`);
const json = JSON.parse(await page.evaluate(() => document.documentElement.innerText));