SeleniumHQ / selenium

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

[🚀 Feature]: Selenium Manager Opt-In to Se 5 Behavior #12985

Closed titusfortner closed 1 week ago

titusfortner commented 10 months ago

Updated suggestions

  1. Change option in Grid:--selenium-manager toggle to --auto-update
  2. Change option in SM: Flip --offline to use --auto-update. This is the Selenium 5 behavior that Grid is opting into and that bindings will get by default for Selenium 5.
  3. When --auto-update is set to true, Selenium Manager should ignore existing drivers if they are not the best match for the discovered/downloaded browser
  4. For Selenium 5 release, just need to "flip the switch" and have --auto-update default to true instead of false

Feature and motivation

Selenium 4 behavior is to use driver specified in Service class, driver specified in System Properties (for Java), or driver found in PATH.

Selenium 5 behavior is going to use driver specified in Service class (or System Properties for Java), but if an outdated driver is found on PATH, Selenium will update it.

What we have now is trying to maintain Selenium 4 behavior unless a user opts-in. We want Selenium Manager to manage the PATH, so we can't completely toggle the whole binary on/off to get what we want right now, so we have to toggle whether Selenium Manager does downloads.

We're calling this "offline mode" which is a bad name for it because people don't understand why it is there or what it means, because they aren't offline, and they didn't set anything to be offline.

What we need is an explicit toggle to set Selenium 5 behavior now. This toggle gets set by grid users with --selenium-manager true

This would allow us to remove the --offline-mode toggle, and would make it so we don't need -skip_driver_in_path or -skip_browser_in_path from #12960

Usage example

SE_AUTO_UPDATE=true
diemol commented 10 months ago

What we have now is trying to maintain Selenium 4 behavior unless a user opts-in. We want Selenium Manager to manage the PATH, so we can't completely toggle the whole binary on/off to get what we want right now, so we have to toggle whether Selenium Manager does downloads.

We're calling this "offline mode" which is a bad name for it because people don't understand why it is there or what it means, because they aren't offline, and they didn't set anything to be offline.

Offline mode is only to allow/disallow network calls to download binaries. But it still works and finds things on the PATH.

So we can't completely toggle the whole binary on/off to get what we want right now

What we wanted was to always use the SM binary so we could centralize the logic that lived in different bindings. For example, to find something on PATH. This is how you convinced me to use the binary in all cases. Why do we want now to turn on or off the SM binary?

titusfortner commented 10 months ago

That's the point, we don't want to toggle SM entirely, but we also don't want to get granular on what gets downloaded. We want to toggle between Selenium 5 behavior (download if PATH driver is bad) and beta behavior (always use PATH driver).

Offline mode is only to allow/disallow network calls to download binaries. But it still works and finds things on the PATH.

The name is correct from an implementation standpoint, but it is bad for logging/warnings because it is confusing to users.

diemol commented 10 months ago

That's the point, we don't want to toggle SM entirely, but we also don't want to get granular on what gets downloaded. We want to toggle between Selenium 5 behavior (download if PATH driver is bad) and beta behavior (always use PATH driver).

Offline mode is only to allow/disallow network calls to download binaries. But it still works and finds things on the PATH.

The name is correct from an implementation standpoint, but it is bad for logging/warnings because it is confusing to users.

So it is an argument to override what SM finds on PATH or not. Which is not related to the offline toggle.

titusfortner commented 10 months ago

You're right, I was thinking through the grid logic incorrectly. There is still a difference in default behavior between the grid and the bindings, even when we add an explicit opt-in toggle for the bindings, because the lack of an opt-in is not opt-out.

titusfortner commented 8 months ago

Ok, thinking through where we are and where we want to be. I've updates the initial description with the specific requests.

diemol commented 3 months ago

We want:

bonigarcia commented 1 month ago

I implemented this feature almost a year ago, but the PR was closed then. I need to check this code is consistent with the current trunk branch, but I believe we can reuse it:

https://github.com/SeleniumHQ/selenium/pull/12960

That PR implemented two flags: --skip-driver-in-path and --skip-browser-in-path. Do we want these two flags or a single one (--ignore-path)?