playwright-video
playwright-video copied to clipboard
support webkit browser
https://github.com/microsoft/playwright/pull/2107
@mxschmitt Did an investigation of this. It's not quite ready yet. We will definitely add it when it is though.
Once its "officially" added (documentation too), we'll take care and add it to the project. Currently to use it it's quite hacky since we have to access internal properties etc. My current test was the following:
const fs = require("fs")
// @ts-check
const playwright = require(".");
(async () => {
const browser = await playwright.webkit.launch({
headless: true
})
const context = await browser.newContext()
const page = await context.newPage()
// @ts-ignore
const wkPage = browser._wkPages.values().next().value
let i = 0;
// @ts-ignore
wkPage._pageProxySession.on("Screencast.frame", async (payload) => {
console.log(Object.keys(payload))
try {
await wkPage._pageProxySession.send('Screencast.frameAck');
} catch (error) {
console.log(`Could not ack screencast frame: ${error}`)
}
fs.writeFileSync(`screenshot-${i}.png`, payload.data, "base64")
i++
})
await wkPage._pageProxySession.send("Screencast.start", {
format: "png"
})
await page.goto("https://amazon.com");
await page.type('#twotabsearchtextbox', "Toilet Paper");
await page.press('#twotabsearchtextbox', "Enter");
await page.waitForNavigation()
await wkPage._pageProxySession.send("Screencast.stop")
await browser.close()
})()
Type/press does not work.