selenium icon indicating copy to clipboard operation
selenium copied to clipboard

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

Open titusfortner opened this issue 1 year ago • 10 comments

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

titusfortner avatar May 28 '24 17:05 titusfortner

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

pujagani avatar May 29 '24 05:05 pujagani

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.

diemol avatar May 29 '24 08:05 diemol

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 avatar May 29 '24 13:05 titusfortner

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

titusfortner avatar May 29 '24 13:05 titusfortner

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

pujagani avatar May 30 '24 05:05 pujagani

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.

pujagani avatar May 30 '24 05:05 pujagani

@pujagani @titusfortner I'm working on this hopefully I will put it for review this weekend :)

aguspe avatar Jul 20 '24 08:07 aguspe

#14287 added Ruby part and the following variables:

  • SE_CHROMEDRIVER
  • SE_EDGEDRIVER
  • SE_GECKODRIVER
  • SE_IEDRIVER
  • SE_SAFARIDRIVER

p0deje avatar Sep 16 '24 16:09 p0deje

I can work on the Python functionality.

Delta456 avatar Sep 17 '24 09:09 Delta456

The python part has also been implemented. In https://github.com/SeleniumHQ/selenium/commit/a2cacc197ff0abd7b74b1025bff88090aafe3b37 and uses the same environment variables as Ruby.

Delta456 avatar Oct 04 '24 11:10 Delta456

This issue is stale because it has been open 280 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Apr 14 '25 20:04 github-actions[bot]

I am working on it for Java.

pujagani avatar Apr 18 '25 13:04 pujagani