Skip to content

[πŸ› Bug]: DriverFinder must not download browsers/drivers, which are not requested by testsΒ #15261

@kool79

Description

@kool79

What happened?

Issues:

  1. Test start is delayed (by 5 min) because of issues with the browser, which I don't use
  2. Extra time and disk space (1.5+GByte) are occupied by downloading browsers/drivers, which I never use.

When I try to run my tests with a local chrome browser, test start is significantly delayed (by 5 min). Rootcause is that driver manager tries to download firefox browser (which I DONT use) and download failed because of server slowness.

Additionaly, driver manager occupies extra gigabytes in my drive with installations, which I'll never use: Firefox browser installation(430MByte), gecko driver(5MByte), Microsoft Edge installation(900MByte), msedge griver(15MByte) etc. It takes extra time as well.

Expected behavoir: Driver manager should download and use only those drivers and browsers, which are requested by invoked tests. DriverManager must not download them, if the corresponding libraries (for chromedriver, firefox driver) just exist in project dependencies.

Workaround is to add fake (empty) paths for each web-driver, which you are NOT going to use:

// if run tests on chrome, provide fake path to avoid DriverManager to download extra binaries
if (System.getProperty("browser",  "chrome"){
    System.setProperty("webdriver.ie.driver", "fake");
    System.setProperty("webdriver.gecko.driver", "fake");
    System.setProperty("webdriver.edge.driver", "fake");
} else if (System.getProperty("browser",  "firefox"){
   .....
}

, but IMHO it is a wrong way. I should not configure anything which I currently(or in future) dont use in my project.

The code, which causes this behavior is located in

Set<WebDriverInfo> infos =
StreamSupport.stream(ServiceLoader.load(WebDriverInfo.class).spliterator(), false)
.filter(WebDriverInfo::isAvailable)
.collect(Collectors.toSet());

It iterates over all available drivers, which are found by ServiceLoader and downloads all corresponding browser installations and drivers, via call to the `isAvaliable' method:

Call to the isAvailable, leads to `DriverFinder#isAvailable(), then DriverFinder#getBinaryPaths(), where the selenium Manager tries to download and cache all those browsers and drivers.

How can we reproduce the issue?

1.clear cache for selenium driver manager,
2.Slow network for any browser download url (which you dont use in your tests)

Relevant log output

-

Operating System

macOS, but relevant for any

Selenium version

4.0.26, but the same will be for 4.0.27

What are the browser(s) and version(s) where you see this issue?

What are the browser driver(s) and version(s) where you see this issue?

na

Are you using Selenium Grid?

local execution

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions