|
32 | 32 | import org.openqa.grid.internal.utils.HtmlRenderer;
|
33 | 33 | import org.openqa.selenium.chrome.ChromeOptions;
|
34 | 34 | import org.openqa.selenium.firefox.FirefoxDriver;
|
| 35 | +import org.openqa.selenium.firefox.FirefoxOptions; |
35 | 36 | import org.openqa.selenium.remote.BrowserType;
|
36 | 37 | import org.openqa.selenium.remote.CapabilityType;
|
37 | 38 |
|
@@ -222,11 +223,20 @@ public void beforeSession(TestSession session) {
|
222 | 223 | if (session.getSlot().getProtocol() == SeleniumProtocol.WebDriver) {
|
223 | 224 | Map<String, Object> cap = session.getRequestedCapabilities();
|
224 | 225 |
|
225 |
| - if (BrowserType.FIREFOX.equals(cap.get(CapabilityType.BROWSER_NAME))) { |
226 |
| - if (session.getSlot().getCapabilities().get(FirefoxDriver.BINARY) != null |
227 |
| - && cap.get(FirefoxDriver.BINARY) == null) { |
228 |
| - session.getRequestedCapabilities().put(FirefoxDriver.BINARY, |
229 |
| - session.getSlot().getCapabilities().get(FirefoxDriver.BINARY)); |
| 226 | + if (BrowserType.FIREFOX.equals(cap.get(CapabilityType.BROWSER_NAME)) && |
| 227 | + session.getSlot().getCapabilities().get(FirefoxDriver.BINARY) != null) { |
| 228 | + String binary = (String) session.getSlot().getCapabilities().get(FirefoxDriver.BINARY); |
| 229 | + |
| 230 | + if (cap.get(FirefoxDriver.BINARY) == null) { |
| 231 | + session.getRequestedCapabilities().put(FirefoxDriver.BINARY, binary); |
| 232 | + } |
| 233 | + |
| 234 | + if (cap.get(FirefoxOptions.FIREFOX_OPTIONS) instanceof Map) { |
| 235 | + @SuppressWarnings("unchecked") Map<String, Object> options = |
| 236 | + (Map<String, Object>) cap.get(FirefoxOptions.FIREFOX_OPTIONS); |
| 237 | + if (options.get("binary") == null) { |
| 238 | + options.put("binary", session.getSlot().getCapabilities().get(FirefoxDriver.BINARY)); |
| 239 | + } |
230 | 240 | }
|
231 | 241 | }
|
232 | 242 |
|
|
0 commit comments