Skip to content

[Question] Attaching playwright to an existing electron window? #10369

Open
@Sunny1861

Description

@Sunny1861

Hi guys,

I am new on playwright, currently investigate if playwright can connect to an existing electron application?
I try to some code:

browser_aut = playwright.chromium.connect("ws://127.0.0.1:8768/devtools/browser/b62e618c-27e9-456a-a0d2-363a27d46755")

Error happen when try to execute it:

**Task exception was never retrieved**
future: <Task finished name='Task-11' coro=<Connection.run.<locals>.init() done, defined at C:\Users\sunme\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_connection.py:174> exception=Error('Playwright connection closed')>
Traceback (most recent call last):
  File "C:\Users\sunme\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_connection.py", line 175, in init
    self.playwright_future.set_result(await self._root_object.initialize())
  File "C:\Users\sunme\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_connection.py", line 135, in initialize
    await self._channel.send(
  File "C:\Users\sunme\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_connection.py", line 39, in send
    return await self.inner_send(method, params, False)
  File "C:\Users\sunme\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_connection.py", line 63, in inner_send
    result = next(iter(done)).result()
  File "C:\Users\sunme\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_browser_type.py", line 203, in connect
    playwright: "Playwright" = next(iter(done)).result()
playwright._impl._api_types.Error: Playwright connection closed

My electron is start with argument --remote-debugging-port=8768, I want to know if playwright has such feature to attach existing electron app? if not, is any plan to support in future?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions