SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
29.84k stars 8.02k forks source link

[🚀 Feature]: Convenience methods for BiDi #13991

Open titusfortner opened 1 month ago

titusfortner commented 1 month ago

Feature and motivation

Java & Python are missing convenience methods for enabling BiDi.

Right now we have.... .NET — options.UseWebSocketUrl = true Ruby — options.web_socket_url = true Python — options.enable_bidi = True JS — enableBidi() Java - enableBidi()

Should we update everything to use enableBiDi() name?

Usage example

options.enableBiDi(true)
titusfortner commented 1 month ago

@pujagani I'm guessing we don't have a good reason for not adding it to java, yet?

pujagani commented 1 month ago

Thank you for bringing this up. Actually we can add it.

pujagani commented 1 month ago

"options.enableBiDi(true)" - @titusfortner Should the user need to pass in true? Isn't enableBidi() sufficient?

titusfortner commented 1 month ago

@pujagani I thought the other methods in Java Options that are boolean require passing in true/false. So, we should do whatever matches the rest of our code.

pujagani commented 1 month ago

That is a fair point. Though the naming, in that case, is like setEnableDownloads(boolean enableDownloads). I was thinking if the name is enableBiDi, then that means just enable it. But if we want to set a value then the name should be such. What do you think?

titusfortner commented 1 month ago

If setXX(boolean) is the pattern, then we should follow that, though I agree it seems a bit much. @diemol any opinions on our conventions here?

diemol commented 1 month ago

I am not sure. If we want to set a property or a value, I like the setXYZ pattern, but if we want to enable a feature, I prefer the enableXYZ pattern.

This is to be said, I saw setEnableDownloads too late; it was already released. I would have done enableDownloads.

pujagani commented 1 month ago

Thank you folks. I think I will go with enableBiDi.