Skip to content

Commit 50fb416

Browse files
committed
grid: Fixing mixing in chrome binary property. Fixes #342
1 parent 5f079bc commit 50fb416

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

java/server/src/org/openqa/grid/selenium/proxy/DefaultRemoteProxy.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.openqa.selenium.remote.BrowserType;
3939
import org.openqa.selenium.remote.CapabilityType;
4040

41+
import java.util.HashMap;
4142
import java.util.List;
4243
import java.util.Map;
4344
import java.util.concurrent.CopyOnWriteArrayList;
@@ -208,14 +209,14 @@ public boolean isDown() {
208209
* The client shouldn't have to care where firefox is installed as long as the correct version is
209210
* launched, however with webdriver the binary location is specified in the desiredCapability,
210211
* making it the responsibility of the person running the test.
211-
*
212+
*
212213
* With this implementation of beforeSession, that problem disappears . If the webdriver slot is
213214
* registered with a firefox using a custom binary location, the hub will handle it.
214-
*
215+
*
215216
* <p>
216217
* For instance if a node registers:
217218
* {"browserName":"firefox","version":"7.0","firefox_binary":"/home/ff7"}
218-
*
219+
*
219220
* and later on a client requests {"browserName":"firefox","version":"7.0"} , the hub will
220221
* automatically append the correct binary path to the desiredCapability before it's forwarded to
221222
* the server. That way the version / install location mapping is done only once at the node
@@ -235,11 +236,11 @@ public void beforeSession(TestSession session) {
235236

236237
if (BrowserType.CHROME.equals(cap.get(CapabilityType.BROWSER_NAME))) {
237238
if (session.getSlot().getCapabilities().get("chrome_binary") != null) {
238-
JsonObject options = (JsonObject) cap.get(ChromeOptions.CAPABILITY);
239+
Map<String, Object> options = (Map<String, Object>) cap.get(ChromeOptions.CAPABILITY);
239240
if (options == null) {
240-
options = new JsonObject();
241+
options = new HashMap<String, Object>();
241242
}
242-
options.addProperty("binary", (String) session.getSlot().getCapabilities().get("chrome_binary"));
243+
options.put("binary", (String) session.getSlot().getCapabilities().get("chrome_binary"));
243244
cap.put(ChromeOptions.CAPABILITY, options);
244245
}
245246
}

0 commit comments

Comments
 (0)