public class CapabilityHelpers
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
APPIUM_PREFIX |
| Constructor and Description |
|---|
CapabilityHelpers() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
getCapability(org.openqa.selenium.Capabilities caps,
java.lang.String name,
java.lang.Class<T> expectedType)
Helper that is used for capability values retrieval.
|
static java.lang.Double |
toDouble(java.lang.Object value)
Converts generic capability value to double.
|
static java.time.Duration |
toDuration(java.lang.Object value)
Converts generic capability value to duration.
|
static java.time.Duration |
toDuration(java.lang.Object value,
java.util.function.Function<java.lang.Long,java.time.Duration> converter)
Converts generic capability value to duration.
|
static java.lang.Integer |
toInteger(java.lang.Object value)
Converts generic capability value to integer.
|
static java.lang.Long |
toLong(java.lang.Object value)
Converts generic capability value to long.
|
static java.lang.Boolean |
toSafeBoolean(java.lang.Object value)
Converts generic capability value to boolean without
throwing exceptions.
|
static java.net.URL |
toUrl(java.lang.Object value)
Converts generic capability value to a url.
|
public static final java.lang.String APPIUM_PREFIX
@Nullable
public static <T> T getCapability(org.openqa.selenium.Capabilities caps,
java.lang.String name,
java.lang.Class<T> expectedType)
T - The corresponding capability type.caps - driver caps objectname - capability nameexpectedType - the expected capability type@Nullable public static java.lang.Boolean toSafeBoolean(java.lang.Object value)
value - The capability value.@Nullable public static java.lang.Integer toInteger(java.lang.Object value)
value - The capability value.java.lang.NumberFormatException - If the given value cannot be parsed to a valid integer.@Nullable public static java.lang.Long toLong(java.lang.Object value)
value - The capability value.java.lang.NumberFormatException - If the given value cannot be parsed to a valid long.@Nullable public static java.lang.Double toDouble(java.lang.Object value)
value - The capability value.java.lang.NumberFormatException - If the given value cannot be parsed to a valid long.@Nullable public static java.time.Duration toDuration(java.lang.Object value)
value - The capability value.java.lang.NumberFormatException - If the given value cannot be parsed to a valid number.@Nullable
public static java.time.Duration toDuration(java.lang.Object value,
java.util.function.Function<java.lang.Long,java.time.Duration> converter)
value - The capability value.converter - Converts the numeric value to a Duration instance.java.lang.NumberFormatException - If the given value cannot be parsed to a valid number.@Nullable public static java.net.URL toUrl(java.lang.Object value)
value - The capability value.java.lang.IllegalArgumentException - If the given value cannot be parsed to a valid url.