Skip to content

Commit 71ccb89

Browse files
committed
[grid] Avoid using SM offline when SM is true.
Fixes #12521
1 parent ebaf121 commit 71ccb89

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

java/src/org/openqa/selenium/grid/node/config/NodeOptions.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -573,22 +573,25 @@ private Map<WebDriverInfo, Collection<SessionFactory>> discoverDrivers(
573573
}
574574

575575
// We don't expect duplicates, but they're fine
576-
List<WebDriverInfo> infos =
577-
StreamSupport.stream(ServiceLoader.load(WebDriverInfo.class).spliterator(), false)
578-
.filter(WebDriverInfo::isPresent)
579-
.sorted(Comparator.comparing(info -> info.getDisplayName().toLowerCase()))
580-
.collect(Collectors.toList());
581-
576+
List<WebDriverInfo> infos = new ArrayList<>();
582577
if (config.getBool(NODE_SECTION, "selenium-manager").orElse(DEFAULT_USE_SELENIUM_MANAGER)) {
583-
List<String> present =
584-
infos.stream().map(WebDriverInfo::getDisplayName).collect(Collectors.toList());
585578
List<WebDriverInfo> driversSM =
586579
StreamSupport.stream(ServiceLoader.load(WebDriverInfo.class).spliterator(), false)
587-
.filter(info -> !present.contains(info.getDisplayName()))
588580
.filter(WebDriverInfo::isAvailable)
589581
.sorted(Comparator.comparing(info -> info.getDisplayName().toLowerCase()))
590582
.collect(Collectors.toList());
591583
infos.addAll(driversSM);
584+
} else {
585+
LOG.log(Level.INFO, "Looking for existing drivers on the PATH.");
586+
LOG.log(
587+
Level.INFO,
588+
"Add '--selenium-manager true' to the startup command to setup drivers automatically.");
589+
List<WebDriverInfo> localDrivers =
590+
StreamSupport.stream(ServiceLoader.load(WebDriverInfo.class).spliterator(), false)
591+
.filter(WebDriverInfo::isPresent)
592+
.sorted(Comparator.comparing(info -> info.getDisplayName().toLowerCase()))
593+
.collect(Collectors.toList());
594+
infos.addAll(localDrivers);
592595
}
593596

594597
// Same

0 commit comments

Comments
 (0)