Skip to content

Commit

Permalink
[java] Converting IE command line switches from list to string, as re…
Browse files Browse the repository at this point in the history
…quired by the driver. Fixes #5319
  • Loading branch information
barancev committed Jan 11, 2018
1 parent 2339f8a commit 42a5916
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@
import org.openqa.selenium.remote.DesiredCapabilities;

import java.time.Duration;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
Expand Down Expand Up @@ -165,6 +167,8 @@ public InternetExplorerOptions addCommandSwitches(String... switches) {
Object raw = getCapability(IE_SWITCHES);
if (raw == null) {
raw = new LinkedList<>();
} else if (raw instanceof String) {
raw = Arrays.asList(((String) raw).split(" "));
}

return amend(
Expand Down Expand Up @@ -245,8 +249,8 @@ public void setCapability(String key, Object value) {
super.setCapability(key, value);

if (IE_SWITCHES.equals(key)) {
if (!(value instanceof List)) {
throw new IllegalArgumentException("Command line switches must be a list");
if (value instanceof List) {
value = ((List<?>) value).stream().map(Object::toString).collect(Collectors.joining(" "));
}
}

Expand Down

0 comments on commit 42a5916

Please sign in to comment.