38
38
import org .openqa .selenium .remote .BrowserType ;
39
39
import org .openqa .selenium .remote .CapabilityType ;
40
40
41
+ import java .util .HashMap ;
41
42
import java .util .List ;
42
43
import java .util .Map ;
43
44
import java .util .concurrent .CopyOnWriteArrayList ;
@@ -208,14 +209,14 @@ public boolean isDown() {
208
209
* The client shouldn't have to care where firefox is installed as long as the correct version is
209
210
* launched, however with webdriver the binary location is specified in the desiredCapability,
210
211
* making it the responsibility of the person running the test.
211
- *
212
+ *
212
213
* With this implementation of beforeSession, that problem disappears . If the webdriver slot is
213
214
* registered with a firefox using a custom binary location, the hub will handle it.
214
- *
215
+ *
215
216
* <p>
216
217
* For instance if a node registers:
217
218
* {"browserName":"firefox","version":"7.0","firefox_binary":"/home/ff7"}
218
- *
219
+ *
219
220
* and later on a client requests {"browserName":"firefox","version":"7.0"} , the hub will
220
221
* automatically append the correct binary path to the desiredCapability before it's forwarded to
221
222
* 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) {
235
236
236
237
if (BrowserType .CHROME .equals (cap .get (CapabilityType .BROWSER_NAME ))) {
237
238
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 );
239
240
if (options == null ) {
240
- options = new JsonObject ();
241
+ options = new HashMap < String , Object > ();
241
242
}
242
- options .addProperty ("binary" , (String ) session .getSlot ().getCapabilities ().get ("chrome_binary" ));
243
+ options .put ("binary" , (String ) session .getSlot ().getCapabilities ().get ("chrome_binary" ));
243
244
cap .put (ChromeOptions .CAPABILITY , options );
244
245
}
245
246
}
0 commit comments