mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: fix protocol-types-generator to work with new API
Follow-up to a2ab645e635797eac857b077c5f4d5986ca31820
This commit is contained in:
parent
55b6fe241e
commit
cd68619786
@ -10,11 +10,13 @@ async function generateChromiunProtocol(revision) {
|
||||
if (revision.local && fs.existsSync(outputPath))
|
||||
return;
|
||||
const playwright = await require('../../index').chromium;
|
||||
const browser = await playwright.launch({ executablePath: revision.executablePath });
|
||||
const browserServer = await playwright.launchServer({ executablePath: revision.executablePath });
|
||||
const origin = browserServer.wsEndpoint().match(/ws:\/\/([0-9A-Za-z:\.]*)\//)[1];
|
||||
const browser = await playwright.connect({ wsEndpoint: browserServer.wsEndpoint() });
|
||||
const page = await browser.newPage();
|
||||
await page.goto(`http://${origin}/json/protocol`);
|
||||
const json = JSON.parse(await page.evaluate(() => document.documentElement.innerText));
|
||||
await browser.close();
|
||||
await browserServer.kill();
|
||||
fs.writeFileSync(outputPath, jsonToTS(json));
|
||||
console.log(`Wrote protocol.ts to ${path.relative(process.cwd(), outputPath)}`);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user