-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
What happened?
Issues:
- Test start is delayed (by 5 min) because of issues with the browser, which I don't use
- 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
selenium/java/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java
Lines 307 to 310 in 55ff83d
| 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