Skip to content

[Feature]: allow playwright persistent context with a selenium grid node/browser #35488

@jfmartinr

Description

@jfmartinr

🚀 Feature Request

I can create a persistent context with selenium using the selenium grid but not with playwright using the selenium grid.
https://playwright.dev/docs/selenium-grid

Example

That way I can leverage my selenium grid infrastructure, in the way it is now I need to create a separate infrastructure for the persistent context.

Motivation

That way we can leverage our selenium grid infrastructure, in the way it is now we need to create a separate infrastructure for the persistent context.

Activity

Skn0tt

Skn0tt commented on Apr 4, 2025

@Skn0tt
Member

I don't see anything in the docs that forbids creating a persistent context with Selenium Grid. What errors did you run into trying it?

jfmartinr

jfmartinr commented on Apr 4, 2025

@jfmartinr
Author

Thanks for your reply @Skn0tt , i'd like you to verify that efectively is creating a node in the selenium grid UI and taking the browser from it using the persistent context, going to localhost:4444 and checking that it's creating a new session.
Because if you have playwright installed it'll take the browser from your playwright installation, that's what happening in my case.
With selenium grid you dont have to do playwright install but only pip install playwright, using python.

Using my configuration, if I use the create_persistent_context() method give me the error that I need to execute playwright install

I can provide you a script to reproduce the error using python later

Skn0tt

Skn0tt commented on Apr 4, 2025

@Skn0tt
Member

No need for a repro - I had a look at the source code and it looks like selenium grid support is only implemented for launch(), not launchPersistentContext():

const seleniumHubUrl = (options as any).__testHookSeleniumRemoteURL || process.env.SELENIUM_REMOTE_URL;

I'm not sure how Persistent Context is implemented in Selenium Grid, so unsure if we can make it work with Selenium Grid. Let's collect feedback on this issue for prioritisation.

jfmartinr

jfmartinr commented on Apr 4, 2025

@jfmartinr
Author

thanks so much for your quick response, i'll be attentive to any news

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Skn0tt@jfmartinr

        Issue actions

          [Feature]: allow playwright persistent context with a selenium grid node/browser · Issue #35488 · microsoft/playwright