File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
java/com/browserstack/util Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 33import com .browserstack .local .Local ;
44import com .browserstack .webdriver .ManagedWebDriver ;
55import org .json .simple .JSONObject ;
6+ import org .json .simple .parser .JSONParser ;
67import org .openqa .selenium .JavascriptExecutor ;
78import org .openqa .selenium .WebDriver ;
89
10+ import java .io .FileReader ;
911import java .util .HashMap ;
1012import java .util .Iterator ;
1113import java .util .Map ;
@@ -52,9 +54,16 @@ public static boolean isLocal(ManagedWebDriver managedWebDriver) {
5254 }
5355
5456 public static void startLocal (Local local , ManagedWebDriver managedWebDriver ) {
57+ JSONParser parser = new JSONParser ();
5558 Map <String , String > options = new HashMap <>();
5659 options .put ("key" , managedWebDriver .getPlatform ().get ("browserstack.key" ).toString ());
60+ String capabilitiesConfigFile = System .getProperty ("caps" , "src/test/resources/conf/local.conf.json" );
5761 try {
62+ JSONObject testConfig = (JSONObject ) parser .parse (new FileReader (capabilitiesConfigFile ));
63+ if (testConfig .containsKey ("localOptions" )) {
64+ JSONObject localOptions = (JSONObject ) testConfig .get ("localOptions" );
65+ options .forEach (localOptions ::putIfAbsent );
66+ }
5867 local .start (options );
5968 } catch (Exception e ) {
6069 throw new Error ("Unable to start BrowserStack Local." );
Original file line number Diff line number Diff line change 1111
1212 "environments" : [{
1313 "browser" : " chrome"
14- }]
14+ }],
15+
16+ "localOptions" : {
17+ "forceLocal" : true
18+ }
1519}
You can’t perform that action at this time.
0 commit comments