SeleniumHQ / selenium

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

[🚀 Feature]: Use Environment Variables to set driver locations #14045

Open titusfortner opened 1 month ago

titusfortner commented 1 month ago

Feature and motivation

We discussed in the Selenium Dev Summit about having the ability to set driver location system-wide using environment variables, similar to how Java currently uses System Properties.

See #13806

Usage example

If we match Java System Properties, it would look like:

os.environ["WEBDRIVER_GECKO_DRIVER"] = path_to_geckodriver
pujagani commented 1 month ago

This is a nit. But why is Java label added to this issue? I might be missing something.

diemol commented 1 month ago

The idea is to leave a path for users who want to avoid Selenium Manager completely. The decision was to implement an env var that the service would use. I guess we can keep the system properties in Java instead of implementing the env var.

titusfortner commented 1 month ago

I included it intentionally because perhaps Java should look for the System Property and the Environment Variable? Is there a scenario where you have a VM where you want to run multiple bindings and only set things one way? /shrug

titusfortner commented 1 month ago

Actually, which convention do we want to match?

For instance in Java: System Property: webdriver.gecko.driver Java wrapper for property: GeckoDriverService.GECKO_DRIVER_EXE_PROPERTY

Options: Match property convention: WEBDRIVER_GECKO_DRIVER Match env convention: SE_GECKODRIVER

pujagani commented 1 month ago

I am in favour of having a consistent way across bindings, if that is possible.

pujagani commented 1 month ago

Match env convention: SE_GECKODRIVER I think this. But I don't have any strong opinions about this. I would prefer that this is the convention we use for other env variables example: SE_EDGE_PATH. It is might be easier for users to identify/set Selenium related environment variables.