[java] Deleting annotation from InternetExplorerOptions, and some code cleanup
import org.openqa.selenium.internal.Require;
import org.openqa.selenium.remote.AbstractDriverOptions;
-import org.openqa.selenium.Beta;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.remote.BrowserType;
*
*new InternetExplorerDriver(options);</pre>
*/
-@Beta
public class InternetExplorerOptions extends AbstractDriverOptions<InternetExplorerOptions> {
final static String IE_OPTIONS = "se:ieOptions";
VALIDATE_COOKIE_DOCUMENT_TYPE,
NATIVE_EVENTS);
- private Map<String, Object> ieOptions = new HashMap<>();
+ private final Map<String, Object> ieOptions = new HashMap<>();
public InternetExplorerOptions() {
setCapability(BROWSER_NAME, BrowserType.IE);
@@ -156,7 +154,7 @@ public InternetExplorerOptions addCommandSwitches(String... switches) {
return amend(
IE_SWITCHES,
- Stream.concat((Stream<?>) ((List) raw).stream(), Stream.of(switches))
+ Stream.concat(((List<?>) raw).stream(), Stream.of(switches))
.filter(i -> i instanceof String)
.map(String.class::cast)
.collect(toList()));
@@ -230,9 +228,9 @@ public void setCapability(String key, Object value) {
if (IE_OPTIONS.equals(key)) {
ieOptions.clear();
- Map<?, ?> streamFrom;
+ Map<String, Object> streamFrom;
if (value instanceof Map) {
- streamFrom = (Map<?, ?>) value;
+ streamFrom = (Map<String, Object>) value;
} else if (value instanceof Capabilities) {
streamFrom = ((Capabilities) value).asMap();
} else {
@@ -244,9 +242,9 @@ public void setCapability(String key, Object value) {
.filter(e -> e.getValue() != null)
.forEach(e -> {
if (IE_SWITCHES.equals(e.getKey())) {
- setCapability((String) e.getKey(), Arrays.asList(((String) e.getValue()).split(" ")));
+ setCapability(e.getKey(), Arrays.asList((e.getValue().toString()).split(" ")));
} else {
- setCapability((String) e.getKey(), e.getValue());
+ setCapability(e.getKey(), e.getValue());
}
});
}
