|
17 | 17 |
|
18 | 18 | package org.openqa.selenium.remote; |
19 | 19 |
|
| 20 | +import static org.openqa.selenium.remote.CapabilityType.ACCEPT_INSECURE_CERTS; |
20 | 21 | import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME; |
21 | 22 | import static org.openqa.selenium.remote.CapabilityType.LOGGING_PREFS; |
22 | 23 | import static org.openqa.selenium.remote.CapabilityType.PLATFORM; |
@@ -137,6 +138,22 @@ public void setJavascriptEnabled(boolean javascriptEnabled) { |
137 | 138 | setCapability(SUPPORTS_JAVASCRIPT, javascriptEnabled); |
138 | 139 | } |
139 | 140 |
|
| 141 | + public boolean acceptInsecureCerts() { |
| 142 | + if (capabilities.containsKey(ACCEPT_INSECURE_CERTS)) { |
| 143 | + Object raw = capabilities.get(ACCEPT_INSECURE_CERTS); |
| 144 | + if (raw instanceof String) { |
| 145 | + return Boolean.parseBoolean((String) raw); |
| 146 | + } else if (raw instanceof Boolean) { |
| 147 | + return ((Boolean) raw).booleanValue(); |
| 148 | + } |
| 149 | + } |
| 150 | + return true; |
| 151 | + } |
| 152 | + |
| 153 | + public void setAcceptInsecureCerts(boolean acceptInsecureCerts) { |
| 154 | + setCapability(ACCEPT_INSECURE_CERTS, acceptInsecureCerts); |
| 155 | + } |
| 156 | + |
140 | 157 | public Object getCapability(String capabilityName) { |
141 | 158 | return capabilities.get(capabilityName); |
142 | 159 | } |
@@ -206,7 +223,11 @@ public static DesiredCapabilities chrome() { |
206 | 223 | } |
207 | 224 |
|
208 | 225 | public static DesiredCapabilities firefox() { |
209 | | - return new DesiredCapabilities(BrowserType.FIREFOX, "", Platform.ANY); |
| 226 | + DesiredCapabilities capabilities = new DesiredCapabilities(BrowserType.FIREFOX, |
| 227 | + "", Platform.ANY); |
| 228 | + capabilities.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true); |
| 229 | + |
| 230 | + return capabilities; |
210 | 231 | } |
211 | 232 |
|
212 | 233 | public static DesiredCapabilities htmlUnit() { |
|
0 commit comments