-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
🚀 Feature Request
Expose the sessionId as a property or method on the browser object when connecting through Selenium 4 protocol. This would allow users to:
Make periodic keep-alive requests to Selenoid to extend the session timeout
Properly manage session lifecycle
Implement custom session monitoring and recovery mechanisms
Example
Problem Description
When connecting to Selenium 4 grid (specifically Selenoid) through Playwright, there's no way to access the sessionId after the connection is established. This creates issues with session timeout management.
Use Case
We use Selenoid as our Selenium grid implementation, which has a session timeout parameter that automatically extends with each regular HTTP request. However, WebSocket connections used by Playwright don't trigger this timeout extension because all commands are sent through the same persistent WebSocket connection.
This causes sessions to be terminated by Selenoid's timeout mechanism even when tests are actively running through the WebSocket.
Current Workaround
The only way to obtain the sessionId is by parsing Playwright's debug logs (pw:browser), which is unreliable and not suitable for production use.
Motivation
Benefits
- Better integration with Selenium grid implementations like Selenoid
- More reliable session management for long-running tests
- Ability to implement custom session keep-alive strategies
- Improved debugging and monitoring capabilities
This feature would significantly improve the reliability of Playwright when used with Selenium grid infrastructures that have session timeout mechanisms.