@@ -44,7 +44,7 @@ public class AppTest
44
44
// public static void setup(String pVer, String pName, String appLocation, String dName)
45
45
public static void setup () throws IOException {
46
46
47
- Runtime .getRuntime ().exec ("/bin/bash export ANDROID_HOME=/Users/shanojthekkan/Library/Android/sdk/" );
47
+ /* Runtime.getRuntime().exec("/bin/bash export ANDROID_HOME=/Users/shanojthekkan/Library/Android/sdk/");
48
48
49
49
CommandLine command = new CommandLine("/usr/local/bin/node");
50
50
command.addArgument("/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js", false);
@@ -58,10 +58,10 @@ public static void setup() throws IOException {
58
58
executor.setExitValue(1);
59
59
executor.execute(command, resultHandler);
60
60
61
-
61
+ */
62
62
63
- // stopAppiumServer();
64
- // startAppiumServer();
63
+ stopAppiumServer ();
64
+ startAppiumServer ();
65
65
66
66
File appDir = new File ("resources" );
67
67
File app = new File (appDir , "Officeworks.apk" );
@@ -88,10 +88,12 @@ public static void startAppiumServer() throws IOException {
88
88
89
89
System .out .println ("Starting Appium Server ......" );
90
90
91
-
91
+ Map <String , String > env = new HashMap <String , String >();
92
+ env .put ("ANDROID_HOME" ,"/Users/shanojthekkan/Library/Android/sdk" );
93
+ env .put ("JAVA_HOME" ,"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home" );
92
94
93
95
service = AppiumDriverLocalService .buildService (new AppiumServiceBuilder ().usingDriverExecutable (new File (AppiumNodeFilePath )).withAppiumJS (
94
- new File (AppiumJavaScriptServerFile )));
96
+ new File (AppiumJavaScriptServerFile )). withEnvironment ( env ) );
95
97
96
98
service .start ();
97
99
0 commit comments