Skip to content

Commit

Permalink
Fix logic to detect browser version
Browse files Browse the repository at this point in the history
  • Loading branch information
bonigarcia committed Jul 25, 2024
1 parent d6f6d2d commit 19da22a
Showing 1 changed file with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,38 +231,38 @@ public Optional<Path> getBrowserPath(String browserName) {

public Optional<String> getBrowserVersionFromTheShell(String browserName) {
Optional<String> browserVersionUsingProperties = empty();
// String browserVersionDetectionCommand = config
// .getBrowserVersionDetectionCommand();
// if (!isNullOrEmpty(browserVersionDetectionCommand)) {
// browserVersionUsingProperties = getBrowserVersionUsingCommand(
// browserVersionDetectionCommand);
// }
// if (browserVersionUsingProperties.isPresent()) {
// return browserVersionUsingProperties;
// }
//
// boolean online = config.isCommandsPropertiesOnlineFirst();
// String propertiesName = COMMANDS_PROPERTIES;
// Properties commandsProperties = getProperties(propertiesName, online);
//
// String onlineMessage = online ? ONLINE : LOCAL;
// log.debug("Detecting {} version using {} {}", browserName,
// onlineMessage, propertiesName);
//
// browserVersionUsingProperties = getBrowserVersionUsingProperties(
// browserName, commandsProperties);
//
// if (!browserVersionUsingProperties.isPresent()) {
// String notOnlineMessage = online ? LOCAL : ONLINE;
// log.debug(
// "Browser version for {} not detected using {} properties (using {} {})",
// browserName, onlineMessage, notOnlineMessage,
// propertiesName);
//
// commandsProperties = getProperties(propertiesName, !online);
// browserVersionUsingProperties = getBrowserVersionUsingProperties(
// browserName, commandsProperties);
// }
String browserVersionDetectionCommand = config
.getBrowserVersionDetectionCommand();
if (!isNullOrEmpty(browserVersionDetectionCommand)) {
browserVersionUsingProperties = getBrowserVersionUsingCommand(
browserVersionDetectionCommand);
}
if (browserVersionUsingProperties.isPresent()) {
return browserVersionUsingProperties;
}

boolean online = config.isCommandsPropertiesOnlineFirst();
String propertiesName = COMMANDS_PROPERTIES;
Properties commandsProperties = getProperties(propertiesName, online);

String onlineMessage = online ? ONLINE : LOCAL;
log.debug("Detecting {} version using {} {}", browserName,
onlineMessage, propertiesName);

browserVersionUsingProperties = getBrowserVersionUsingProperties(
browserName, commandsProperties);

if (!browserVersionUsingProperties.isPresent()) {
String notOnlineMessage = online ? LOCAL : ONLINE;
log.debug(
"Browser version for {} not detected using {} properties (using {} {})",
browserName, onlineMessage, notOnlineMessage,
propertiesName);

commandsProperties = getProperties(propertiesName, !online);
browserVersionUsingProperties = getBrowserVersionUsingProperties(
browserName, commandsProperties);
}

return browserVersionUsingProperties;
}
Expand Down

0 comments on commit 19da22a

Please sign in to comment.