|
22 | 22 | import org.openqa.selenium.Capabilities; |
23 | 23 | import org.openqa.selenium.ImmutableCapabilities; |
24 | 24 | import org.openqa.selenium.PersistentCapabilities; |
| 25 | + |
25 | 26 | import java.util.ArrayList; |
26 | 27 | import java.util.HashMap; |
27 | 28 | import java.util.List; |
@@ -56,6 +57,10 @@ public Capabilities apply(Capabilities capabilities) { |
56 | 57 | return capabilities; |
57 | 58 | } |
58 | 59 |
|
| 60 | + if ("internet explorer".equalsIgnoreCase(capabilities.getBrowserName())) { |
| 61 | + return new ImmutableCapabilities(removeUnknownExtensionsForIE(capabilities)); |
| 62 | + } |
| 63 | + |
59 | 64 | String browserName = capabilities.getBrowserName().toLowerCase(); |
60 | 65 | if (!BROWSER_OPTIONS.containsKey(browserName)) { |
61 | 66 | return capabilities; |
@@ -95,11 +100,21 @@ public Capabilities apply(Capabilities capabilities) { |
95 | 100 | return slotStereotype.merge(capabilities); |
96 | 101 | } |
97 | 102 |
|
| 103 | + private Map<String, Object> removeUnknownExtensionsForIE(Capabilities capabilities) { |
| 104 | + Map<String, Object> toReturn = new HashMap<>(capabilities.asMap()); |
| 105 | + capabilities.asMap().keySet() |
| 106 | + .stream() |
| 107 | + .filter(key -> key.contains(":")) |
| 108 | + .filter(key -> !"se:ieOptions".equalsIgnoreCase(key)) |
| 109 | + .forEach(toReturn::remove); |
| 110 | + return toReturn; |
| 111 | + } |
| 112 | + |
98 | 113 | private Map<String, Object> mergeChromiumOptions(Map<String, Object> stereotypeOptions, |
99 | 114 | Map<String, Object> capsOptions) { |
100 | 115 | Map<String, Object> toReturn = new HashMap<>(stereotypeOptions); |
101 | 116 |
|
102 | | - for (Map.Entry<String, Object> entry : capsOptions.entrySet()) { |
| 117 | + for (Map.Entry<String, Object> entry : capsOptions.entrySet()) { |
103 | 118 | String name = entry.getKey(); |
104 | 119 | Object value = entry.getValue(); |
105 | 120 | if (name.equals("args")) { |
|
0 commit comments