Coder Social home page Coder Social logo

Comments (7)

aslushnikov avatar aslushnikov commented on April 28, 2024 6

Could you kindly share what the expected sequence is to start a playwright-controlled Firefox instance with extensions installed?

@gurupras @lfilho Oops sorry it took me a while. I posted some details here: mozilla/web-ext#1927 (comment)

from playwright.

aslushnikov avatar aslushnikov commented on April 28, 2024 4

@Banou26 you can already load web extensions to firefox using web-ext - that's the recommended way to load extensions to ff. We explored it a while back here: puppeteer/puppeteer#4162 (comment)

Same instructions should work for PlayWright; cc'ing @denar90 who poked a lot into this.

Hope this helps!

from playwright.

gurupras avatar gurupras commented on April 28, 2024 2

Could you kindly share what the expected sequence is to start a playwright-controlled Firefox instance with extensions installed?

I don't quite understand how to trigger all of this from my playwright script.
Should we be overriding executablePath in browser.launch() to point to web-ext and pass its arguments?

from playwright.

lfilho avatar lfilho commented on April 28, 2024 1

I second what @gurupras said.

I'm also very interested in how to use Playwright for testing WebExtensions. I tried the approach above with Playwright but I'm stuck with the following error when running my script:

Error when running playwright script:

    WebSocket error: Unexpected server response: 400
    =================== firefox.connect logs ===================
    <ws connecting> ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501/
    <ws connect error> ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501/ Unexpected server response: 400
    <ws disconnected> ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501/
    ============================================================

Here's my code relevant bits:

web-ext confirmation juggler is listening:

[firefox/index.js][debug] Firefox stdout: Juggler listening on ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501

my playwright script:

  browser = await browserWrapper.firefox.connect({
    wsEndpoint: 'ws://127.0.0.1:1234/',
    // also tried with:
    // wsEndpoint: 'ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501',
    // and:
    // wsEndpoint: 'ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501/',

    logger: { // doesn't show any other extra information
      isEnabled: () => true,
      log: (name, severity, message, args) => console.log(`${name} ${message}`),
    },
  });

I'm using: "playwright-firefox": "1.1.1"

That's the only missing bit in my quest to fully automate my extension's testing :)
Any ideas how to accomplish testing that? /cc @aslushnikov @denar90

Thank you!

from playwright.

JoelEinbinder avatar JoelEinbinder commented on April 28, 2024

Considering WebKit doesn’t support web extensions, would it be fair to consider this a request for Firefox extension support?

You should be able to load extensions into Firefox though some launch arguments. But we don’t currently have a way for you to evaluate JavaScript in the extension context.

from playwright.

Banou26 avatar Banou26 commented on April 28, 2024

Yeah, i was mainly thinking about FF

from playwright.

lfilho avatar lfilho commented on April 28, 2024

I have also just tried a different approach, without using juggler but rather connecting to the remote debugger as suggested in a different thread. I posted all details here: mozilla/web-ext#1927 (there's details about puppeteer and playwright)

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.