Code Monkey home page Code Monkey logo

Comments (10)

NanFengCheong avatar NanFengCheong commented on July 18, 2024 6

@aslushnikov
Hi,

Do you have example to launch from index.js and control the electron using playwright?

from playwright.

pavelfeldman avatar pavelfeldman commented on July 18, 2024 3

@akosyakov: in case you are still interested...

https://www.npmjs.com/package/playwright-electron is now publicly available. It does not have docs, just a bare README.md, but it should be enough to get a rough idea about it. Please let us know what you think!

Edit: Please reference to an up to date guide here: https://playwright.dev/docs/api/class-electron/

from playwright.

sAbakumoff avatar sAbakumoff commented on July 18, 2024 2

Yes, it should be doable by manually hooking up the debugging protocol as corevo says. But Iā€™d really like to have a nicer solution that just works out of the box.

My app is built with electron but it needs to load a certain page in the headless browser and read cookies. I don't want to run another headless browser because electron already has the debugger window. How exactly to "hook up" the debugging protocol?

from playwright.

aslushnikov avatar aslushnikov commented on July 18, 2024 1

An electron support is now available with playwright-electron! šŸŽ‰

Edit: Please reference to an up to date guide here: https://playwright.dev/docs/api/class-electron/

from playwright.

corevo avatar corevo commented on July 18, 2024

I'm assuming you can do it today the same way you would with puppeteer, by enabling the Chrome debugging protocol.

const { app, BrowserWindow } = require('electron')
const puppeteer = require('puppeteer-core')

app.commandLine.appendSwitch('remote-debugging-port', '8315')
const electronBrowser = await puppeteer.connect({
    browserURL: 'http://localhost:8315',
  })

By just converting the correct puppeteer calls to playwright, I haven't tried it for myself though.

from playwright.

JoelEinbinder avatar JoelEinbinder commented on July 18, 2024

Yes, it should be doable by manually hooking up the debugging protocol as corevo says. But Iā€™d really like to have a nicer solution that just works out of the box.

There are some logistics to work out. Playwright needs to be compatible with the version of electron. Also the way we handle contexts might clash with how electron is implemented. But these both seem like problems that can be overcome.

from playwright.

akosyakov avatar akosyakov commented on July 18, 2024

puppeteer has some issues to support Electron: puppeteer/puppeteer#4283 I was wondering whether it will be the same here.

from playwright.

pavelfeldman avatar pavelfeldman commented on July 18, 2024

Folding into #647

from playwright.

akosyakov avatar akosyakov commented on July 18, 2024

@pavelfeldman cool! thanks. Do I understand correctly that it works only against Electron 9?

from playwright.

pavelfeldman avatar pavelfeldman commented on July 18, 2024

Yes, Electron 9+ at this point.

from playwright.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.