Skip to content

Commit d05ab6f

Browse files
titusfortnerdiemol
andauthored
few tweaks to driver finding logic (#12269)
few tweaks to driver finding logic based on comparison between implementations Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
1 parent ec65a7d commit d05ab6f

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

java/src/org/openqa/selenium/manager/SeleniumManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ private synchronized File getBinary() {
191191
throw new WebDriverException("Unable to obtain Selenium Manager Binary", e);
192192
}
193193
}
194+
LOG.fine(String.format("Selenium Manager binary found at: %s", binary));
195+
194196
return binary;
195197
}
196198

java/src/org/openqa/selenium/remote/service/DriverFinder.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ public class DriverFinder {
1414

1515
public static String getPath(DriverService service, Capabilities options) {
1616
Require.nonNull("Browser options", options);
17-
String defaultPath = new ExecutableFinder().find(service.getDriverName());
18-
String exePath = System.getProperty(service.getDriverProperty(), defaultPath);
17+
String exePath = System.getProperty(service.getDriverProperty());
18+
19+
if (exePath == null) {
20+
exePath = new ExecutableFinder().find(service.getDriverName());
21+
}
1922

2023
if (service.getDriverExecutable() != null) {
21-
// This is the case for Safari and Safari Technology Preview
24+
// This is needed for Safari Technology Preview until Selenium Manager manages locating on PATH
2225
exePath = service.getDriverExecutable().getAbsolutePath();
2326
}
2427

py/selenium/webdriver/common/selenium_manager.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def get_binary() -> Path:
5656
if not path.is_file():
5757
raise WebDriverException(f"Unable to obtain working Selenium Manager binary; {path}")
5858

59+
logger.debug("Selenium Manager binary found at: {location}")
60+
5961
return path
6062

6163
def driver_location(self, options: BaseOptions) -> str:
@@ -114,12 +116,13 @@ def run(args: List[str]) -> str:
114116
except Exception as err:
115117
raise WebDriverException(f"Unsuccessful command executed: {command}; {err}")
116118

119+
for item in output["logs"]:
120+
if item["level"] == "WARN":
121+
logger.warning(item["message"])
122+
if item["level"] == "DEBUG" or item["level"] == "INFO":
123+
logger.debug(item["message"])
124+
117125
if completed_proc.returncode:
118126
raise WebDriverException(f"Unsuccessful command executed: {command}.\n{result}{stderr}")
119127
else:
120-
for item in output["logs"]:
121-
if item["level"] == "WARN":
122-
logger.warning(item["message"])
123-
if item["level"] == "DEBUG" or item["level"] == "INFO":
124-
logger.debug(item["message"])
125128
return result

0 commit comments

Comments
 (0)