Skip to content

Commit 6903496

Browse files
authored
fix(build): generate protocol in chromium (#1579)
1 parent a042466 commit 6903496

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

utils/protocol-types-generator/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ const util = require('util');
99
async function generateChromiumProtocol(executablePath) {
1010
const outputPath = path.join(__dirname, '..', '..', 'src', 'chromium', 'protocol.ts');
1111
const playwright = await require('../../index').chromium;
12-
const browserServer = await playwright.launchServer({ executablePath, args: ['--no-sandbox'] });
13-
const origin = browserServer.wsEndpoint().match(/ws:\/\/([0-9A-Za-z:\.]*)\//)[1];
14-
const browser = await playwright.connect({ wsEndpoint: browserServer.wsEndpoint() });
12+
const args = playwright._defaultArgs();
13+
args.push('--remote-debugging-port=9339');
14+
const browser = await playwright.launch({ executablePath, args, ignoreDefaultArgs: true });
1515
const page = await browser.newPage();
16-
await page.goto(`http://${origin}/json/protocol`);
16+
await page.goto(`http://localhost:9339/json/protocol`);
1717
const json = JSON.parse(await page.evaluate(() => document.documentElement.innerText));
18-
await browserServer.close();
18+
await browser.close();
1919
await fs.promises.writeFile(outputPath, jsonToTS(json));
2020
console.log(`Wrote protocol.ts to ${path.relative(process.cwd(), outputPath)}`);
2121
}

0 commit comments

Comments
 (0)