Now, I purposely made some wrong changes in the code like
File file = new File(“D:/programfiles”);
ServerArguments serverArguments = new ServerArguments();
serverArguments.setArgument(“address”,“127.0.0.1”); [removed the ‘–’]
serverArguments.setArgument(“–chromedriver-port”, 9516);
serverArguments.setArgument(“–bootstrap-port”, 4725);
serverArguments.setArgument(“–no-reset”, true);
serverArguments.setArgument(“–local-timezone”, true);
AppiumServer appiumServer = new AppiumServer(file, serverArguments);
appiumServer.startServer();
System.out.println(“started”)
When I run the above code I get an exception like:
SUCCESS: The process “node.exe” with PID 5824 has been terminated.
Appium server is starting
Aug 12, 2015 11:28:56 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server is starting…
Aug 12, 2015 11:28:56 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:28:57 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:28:58 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:28:59 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:01 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:02 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:03 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:04 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:05 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:06 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:07 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:08 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:09 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:11 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:12 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:13 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:14 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:15 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:16 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:17 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:18 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:19 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:20 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:22 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:23 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:24 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Aug 12, 2015 11:29:25 AM com.github.genium_framework.appium.support.server.AppiumServer startServer
INFO: Server has not started yet. Trying again in one second…
Exception in thread “main” com.github.genium_framework.server.exception.ServerTimeoutException: The server didn’t start after 30 seconds with error:
usage: appium.js [-h] [-v] [–shell]
[–localizable-strings-dir LOCALIZABLESTRINGSDIR] [–app APP]
[–ipa IPA] [-U UDID] [-a ADDRESS] [-p PORT]
[-ca CALLBACKADDRESS] [-cp CALLBACKPORT] [-bp BOOTSTRAPPORT]
[-k] [-r BACKENDRETRIES] [–session-override] [–full-reset]
[–no-reset] [-l] [-lt LAUNCHTIMEOUT] [-g LOG]
[–log-level {info,info:debug,info:info,info:warn,info:error,warn,warn:debug,warn:info,warn:warn,warn:error,error,error:debug,error:info,error:warn,error:error,debug,debug:debug,debug:info,debug:warn,debug:error}]
[–log-timestamp] [–local-timezone] [–log-no-colors]
[-G WEBHOOK] [–native-instruments-lib]
[–app-pkg ANDROIDPACKAGE] [–app-activity ANDROIDACTIVITY]
[–app-wait-package ANDROIDWAITPACKAGE]
[–app-wait-activity ANDROIDWAITACTIVITY]
[–android-coverage ANDROIDCOVERAGE] [–avd AVD]
[–avd-args AVDARGS]
[–device-ready-timeout ANDROIDDEVICEREADYTIMEOUT] [–safari]
[–device-name DEVICENAME] [–platform-name PLATFORMNAME]
[–platform-version PLATFORMVERSION]
[–automation-name AUTOMATIONNAME]
[–browser-name BROWSERNAME] [–default-device]
[–force-iphone] [–force-ipad] [–language LANGUAGE]
[–locale LOCALE] [–calendar-format CALENDARFORMAT]
[–orientation ORIENTATION]
[–tracetemplate AUTOMATIONTRACETEMPLATEPATH]
[–instruments INSTRUMENTSPATH] [–show-sim-log]
[–show-ios-log] [–nodeconfig NODECONFIG] [-ra ROBOTADDRESS]
[-rp ROBOTPORT] [–selendroid-port SELENDROIDPORT]
[–chromedriver-port CHROMEDRIVERPORT]
[–chromedriver-executable CHROMEDRIVEREXECUTABLE]
[–use-keystore] [–keystore-path KEYSTOREPATH]
[–keystore-password KEYSTOREPASSWORD] [–key-alias KEYALIAS]
[–key-password KEYPASSWORD] [–show-config]
[–no-perms-check] [–command-timeout DEFAULTCOMMANDTIMEOUT]
[–keep-keychains] [–strict-caps] [–isolate-sim-device]
[–tmp TMPDIR] [–trace-dir TRACEDIR]
[–intent-action INTENTACTION]
[–intent-category INTENTCATEGORY]
[–intent-flags INTENTFLAGS]
[–intent-args OPTIONALINTENTARGUMENTS]
[–dont-stop-app-on-reset] [–debug-log-spacing]
[–suppress-adb-kill-server] [–async-trace]
appium.js: error: Unrecognized arguments: address 127.0.0.1.
The error was correctly thrown at the console.
Now I added the ‘–’ infront of the address and I run the code.
No exceptions thrown in the screen.
In the File Object do we need to pass node.exe path or appium.js path
Because in command line arguments I will pass both of the directory path.