Skip to content

Commit

Permalink
Merge pull request #2028 from zebrunner/idle-timeout-as-string
Browse files Browse the repository at this point in the history
 Convert idleTimeout capability to String
  • Loading branch information
vdelendik authored Jan 16, 2023
2 parents c220865 + 02316f6 commit ea90190
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ protected DesiredCapabilities initBaseCapabilities(DesiredCapabilities capabilit
}

protected DesiredCapabilities initCapabilities(DesiredCapabilities capabilities) {
List<String> stringCaps = List.of("idleTimeout");
ArrayList<String> numericCaps = new ArrayList<String>(
Arrays.asList("idleTimeout", "waitForIdleTimeout"));
Arrays.asList("waitForIdleTimeout"));

// read all properties which starts from "capabilities.*" prefix and add them into desired capabilities.
final String prefix = SpecialKeywords.CAPABILITIES + ".";
Expand All @@ -80,7 +81,9 @@ protected DesiredCapabilities initCapabilities(DesiredCapabilities capabilities)
String value = R.CONFIG.get(entry.getKey());
if (!value.isEmpty()) {
String cap = entry.getKey().replaceAll(prefix, "");
if (numericCaps.contains(cap) && isNumber(value)) {
if(stringCaps.contains(cap)) {
capabilities.setCapability(cap, value);
} else if (numericCaps.contains(cap) && isNumber(value)) {
LOGGER.debug("Adding " + cap + " to capabilities as integer");
capabilities.setCapability(cap, Integer.parseInt(value));
} else if ("false".equalsIgnoreCase(value)) {
Expand Down

0 comments on commit ea90190

Please sign in to comment.