[java] Fixing detection of geckodriver version
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.testing.drivers.SauceDriver;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -101,6 +102,12 @@ public static boolean isOldChromedriver(WebDriver driver) {
}
Capabilities caps = ((HasCapabilities) driver).getCapabilities();
String chromedriverVersion = (String) caps.getCapability("chrome.chromedriverVersion");
+ if (chromedriverVersion == null) {
+ Object chrome = caps.getCapability("chrome");
+ if (chrome != null) {
+ chromedriverVersion = (String) ((Map<?,?>) chrome).get("chromedriverVersion");
+ }
+ }
if (chromedriverVersion != null) {
String[] versionMajorMinor = chromedriverVersion.split("\\.", 2);
if (versionMajorMinor.length > 1) {
