class CapabilitiesComparator
extends java.lang.Object
implements java.util.Comparator<org.openqa.selenium.Capabilities>
Capabilities
against a desired standard. Capabilities are compared
by...
browser name
,
browser version
,
whether JavaScript is enabled
,
platform
When comparing platforms, preference will be given to an exact platform match over a fuzzy
match (e.g. Platform.WINDOWS will match Platform.WINDOWS before it matches Platform.XP).
Furthermore, configurations matching the current system's platform will be given preference.
For example, when Platform.getCurrent() == Platform.WINDOWS
, a set of Capabilities
with Platform.WINDOWS
will score higher than one with Platform.ANY
.
Modifier and Type | Class and Description |
---|---|
private static class |
CapabilitiesComparator.CapabilityScorer<T> |
private static class |
CapabilitiesComparator.CurrentPlatformScorer |
private static class |
CapabilitiesComparator.FuzzyPlatformScorer |
private static class |
CapabilitiesComparator.VersionScorer |
Modifier and Type | Field and Description |
---|---|
private java.util.Comparator<org.openqa.selenium.Capabilities> |
compareWith |
Constructor and Description |
---|
CapabilitiesComparator(org.openqa.selenium.Capabilities desiredCapabilities,
org.openqa.selenium.Platform currentPlatform) |
Modifier and Type | Method and Description |
---|---|
int |
compare(org.openqa.selenium.Capabilities a,
org.openqa.selenium.Capabilities b) |
static <T extends org.openqa.selenium.Capabilities> |
getBestMatch(org.openqa.selenium.Capabilities against,
java.util.Collection<T> toCompare) |
(package private) static <T extends org.openqa.selenium.Capabilities> |
getBestMatch(org.openqa.selenium.Capabilities against,
java.util.Collection<T> toCompare,
org.openqa.selenium.Platform currentPlatform) |
private static boolean |
isNullOrAny(org.openqa.selenium.Platform platform) |
private final java.util.Comparator<org.openqa.selenium.Capabilities> compareWith
public CapabilitiesComparator(org.openqa.selenium.Capabilities desiredCapabilities, org.openqa.selenium.Platform currentPlatform)
public static <T extends org.openqa.selenium.Capabilities> T getBestMatch(org.openqa.selenium.Capabilities against, java.util.Collection<T> toCompare)
static <T extends org.openqa.selenium.Capabilities> T getBestMatch(org.openqa.selenium.Capabilities against, java.util.Collection<T> toCompare, org.openqa.selenium.Platform currentPlatform)
public int compare(org.openqa.selenium.Capabilities a, org.openqa.selenium.Capabilities b)
compare
in interface java.util.Comparator<org.openqa.selenium.Capabilities>
private static boolean isNullOrAny(org.openqa.selenium.Platform platform)