You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[🐛 Bug]: BiDi WebSocket connections are established at different points across Selenium bindings #18258
Java: during session creation, when the returned capabilities include webSocketUrl.
Ruby: during session creation when BiDi is enabled.
Python: lazily, when a BiDi-backed feature is first accessed.
JavaScript: lazily, on first BiDi access.
.NET: explicitly via AsBiDiAsync().
Let’s discuss these differences and decide whether the connection lifecycle should be aligned across bindings.
Reproducible Code
var driver = new Chrome(with websocketurl enabled) // establish connection here?if not success then what?driver.DoSomethingBiDiRequired() // or here?
I think this is an easy one. There are going to be several features that are going to require async handlers or pin scripts that need to run when the session starts, not whenever the first BiDi command happens. So JS & Python should be updated, and we already decided against setting the mode explicitly in #17670
var driver = new Chrome(bidi_enabled=true); // BOOM if remote end doesn't support bidi
It makes a connection once, no ceremonies around lazy-initialization. Performant. But what to do for remote-ends what doesn't support BiDi. If we go this way, we should raise an exception. Like currently Safari doesn't return correct websocket url when bidi_enabled. It means all users that requested bidi_enabled will be broken. I think it is still good. Users requests capability, remote end doesn't support it, we honestly say about it.
Lazy init
No attempts to establish a connection at all. User requests bidi_enabled, we are fine. If user uses classic only commands, he is fine.
But it adds ceremony for us and user's performance:
driver.DoSomethingWhichRequiresBiDiCommand()
{
var bidi = GiveMeBiDiAndConnectIfNotYetConnected(); // this line of code should be thread-safe, and we should put this line into any WebDriver method
bidi.SendRealCommand();
}
Personally I feel it is better make a websocket connection once supposing it must be made successfully. And fail fast. It avoids "thread-safe lazy init" on each user's command. For users, who gets an exception like "we tried establish a connection but seems your browser doesn't support it" we can say don't request bidi_enabled capability (UseWebsocketUrl=true).
Just opinion, I don't see entire picture and further plans.
Activity
selenium-ci commentedon Oct 28, 2026
@nvborisenko, thank you for creating this issue. We will troubleshoot it as soon as we can.
Selenium Triage Team: remember to follow the Triage Guide
titusfortner commentedon Oct 28, 2026
I think this is an easy one. There are going to be several features that are going to require async handlers or pin scripts that need to run when the session starts, not whenever the first BiDi command happens. So JS & Python should be updated, and we already decided against setting the mode explicitly in #17670
AutomatedTester commentedon Oct 28, 2026
How is lazy loading on first command going to be different to eager connection?
nvborisenko commentedon Oct 29, 2026
It depends on use cases..
It makes a connection once, no ceremonies around lazy-initialization. Performant. But what to do for remote-ends what doesn't support BiDi. If we go this way, we should raise an exception. Like currently Safari doesn't return correct websocket url when bidi_enabled. It means all users that requested bidi_enabled will be broken. I think it is still good. Users requests capability, remote end doesn't support it, we honestly say about it.
No attempts to establish a connection at all. User requests bidi_enabled, we are fine. If user uses classic only commands, he is fine.
But it adds ceremony for us and user's performance:
Personally I feel it is better make a websocket connection once supposing it must be made successfully. And fail fast. It avoids "thread-safe lazy init" on each user's command. For users, who gets an exception like "we tried establish a connection but seems your browser doesn't support it" we can say don't request bidi_enabled capability (UseWebsocketUrl=true).
Just opinion, I don't see entire picture and further plans.