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

This commit is contained in:
Dmitry Gozman 2020-03-27 22:42:39 -07:00 committed by GitHub
parent f72b6b4778
commit 6503c83302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));