Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

support webkit browser #21

Open
roughsoft opened this issue May 9, 2020 · 2 comments
Open

support webkit browser #21

roughsoft opened this issue May 9, 2020 · 2 comments

Comments

@roughsoft
Copy link

microsoft/playwright#2107

@jperl
Copy link
Member

jperl commented May 9, 2020

@mxschmitt Did an investigation of this. It's not quite ready yet. We will definitely add it when it is though.

@mxschmitt
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants