Skip to content

Commit cc79de6

Browse files
committed
[java] Putting all valid IEOptions only in se:ieOptions
This is part of the work being done to remove JWP support from Java. Fixes #10822
1 parent 334a103 commit cc79de6

File tree

2 files changed

+11
-33
lines changed

2 files changed

+11
-33
lines changed

java/src/org/openqa/selenium/ie/InternetExplorerOptions.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ private InternetExplorerOptions amend(String optionName, Object value) {
237237

238238
@Override
239239
public void setCapability(String key, Object value) {
240-
super.setCapability(key, value);
241-
242240
if (IE_SWITCHES.equals(key)) {
243241
if (value instanceof List) {
244242
value = ((List<?>) value).stream().map(Object::toString).collect(Collectors.joining(" "));
@@ -247,6 +245,9 @@ public void setCapability(String key, Object value) {
247245

248246
if (CAPABILITY_NAMES.contains(key)) {
249247
ieOptions.put(key, value);
248+
} else if (!IE_OPTIONS.equals(key)) {
249+
// Regular, top level value
250+
super.setCapability(key, value);
250251
}
251252

252253
if (IE_OPTIONS.equals(key)) {
@@ -257,17 +258,17 @@ public void setCapability(String key, Object value) {
257258
} else if (value instanceof Capabilities) {
258259
streamFrom = ((Capabilities) value).asMap();
259260
} else {
260-
throw new IllegalArgumentException("Value must not be null for " + key);
261+
throw new IllegalArgumentException(
262+
"Value for " + key + " must be of type Map or Capabilities");
261263
}
262-
263264
streamFrom.entrySet().stream()
264-
.filter(e -> CAPABILITY_NAMES.contains(e.getKey()))
265-
.filter(e -> e.getValue() != null)
266-
.forEach(e -> {
267-
if (IE_SWITCHES.equals(e.getKey())) {
268-
setCapability(e.getKey(), Arrays.asList((e.getValue().toString()).split(" ")));
265+
.filter(entry -> CAPABILITY_NAMES.contains(entry.getKey()))
266+
.filter(entry -> entry.getValue() != null)
267+
.forEach(entry -> {
268+
if (IE_SWITCHES.equals(entry.getKey())) {
269+
setCapability(entry.getKey(), Arrays.asList((entry.getValue().toString()).split(" ")));
269270
} else {
270-
setCapability(e.getKey(), e.getValue());
271+
setCapability(entry.getKey(), entry.getValue());
271272
}
272273
});
273274
}

java/src/org/openqa/selenium/remote/RemoteWebDriver.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
import java.net.MalformedURLException;
7373
import java.net.URL;
7474
import java.time.Duration;
75-
import java.util.Arrays;
7675
import java.util.Base64;
7776
import java.util.Collection;
7877
import java.util.Collections;
@@ -105,27 +104,6 @@ public class RemoteWebDriver implements WebDriver,
105104
PrintsPage,
106105
TakesScreenshot {
107106

108-
// TODO: Remove in 4.4 when all IE caps go inside se:ieOptions
109-
private static final List<String> IE_CAPABILITY_NAMES = Arrays.asList(
110-
"browserAttachTimeout",
111-
"elementScrollBehavior",
112-
"enablePersistentHover",
113-
"ie.enableFullPageScreenshot",
114-
"ie.forceCreateProcessApi",
115-
"ie.forceShellWindowsApi",
116-
"ie.ensureCleanSession",
117-
"ie.browserCommandLineSwitches",
118-
"ie.usePerProcessProxy",
119-
"ignoreZoomSetting",
120-
"initialBrowserUrl",
121-
"ignoreProtectedModeSettings",
122-
"requireWindowFocus",
123-
"ie.fileUploadDialogTimeout",
124-
"nativeEvents",
125-
"ie.useLegacyFileUploadDialogHandling",
126-
"ie.edgechromium",
127-
"ie.edgepath");
128-
129107
// TODO: This static logger should be unified with the per-instance localLogs
130108
private static final Logger logger = Logger.getLogger(RemoteWebDriver.class.getName());
131109
private final ElementLocation elementLocation = new ElementLocation();
@@ -705,7 +683,6 @@ private void checkNonW3CCapabilities(Capabilities capabilities) {
705683
List<String> invalid = capabilities.asMap().keySet()
706684
.stream()
707685
.filter(key -> !(new AcceptedW3CCapabilityKeys().test(key)))
708-
.filter(key -> !IE_CAPABILITY_NAMES.contains(key))
709686
.collect(Collectors.toList());
710687

711688
if (!invalid.isEmpty()) {

0 commit comments

Comments
 (0)