Hi all, I am getting some error on running appium server:
The code is as below:
try {
//Set Capabilities
cap = new DesiredCapabilities();
cap.setCapability(ânoResetâ, âfalseâ);
cap.setCapability(âdeviceNameâ, deviceUDID);
cap.setCapability(âplatformVersionâ, version);
cap.setCapability(âautomationNameâ, âUiAutomator2â);
cap.setCapability(âplatformNameâ, âAndroidâ);
cap.setCapability(âappPackageâ, appPackage);
cap.setCapability(âappActivityâ, appActivity);
//cap.setCapability("--nodeconfig", "");
System.out.println("After calling buildService: ");
File classPathRoot = new File(System.getProperty("user.dir"));
String osName = System.getProperty("os.name");
service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File(appiumInstallationDir + File.separator + "nodejs" + File.separator + "node.exe"))
.withAppiumJS(new File(appiumInstallationDir + " (x86)" + File.separator + "Appium" + File.separator
+ "node_modules" + File.separator + "appium" + File.separator + "bin" + File.separator + "appium.js"))
.withIPAddress(address)
//.withArgument(GeneralServerFlag.ROBOT_ADDRESS, deviceUDID)
.withArgument(GeneralServerFlag.ROBOT_PORT, devicePort)
.usingPort(Integer.parseInt(serverPort))
.withStartUpTimeOut(20, TimeUnit.SECONDS)
.withCapabilities(cap)
.withArgument(GeneralServerFlag.SESSION_OVERRIDE)
.withArgument(GeneralServerFlag.LOG_LEVEL,"error")
.withArgument(GeneralServerFlag.CONFIGURATION_FILE, "")
.withLogFile(new File(new File(classPathRoot, File.separator + "log"), "androidLog.txt")));
if(! service.isRunning()){
service.start();
appiumServiceUrl = service.getUrl().toString();
System.out.println("Try appiumServiceUrl: "+appiumServiceUrl);
}
} catch (Exception e) {
e.printStackTrace();
appiumServiceUrl = service.getUrl().toString();
System.out.println("Catch appiumServiceUrl: "+appiumServiceUrl);
service.stop();
//service.stop();
}
And Iâm getting error as below:
io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: The local appium server has not been started. The given Node.js executable: C:\Program Files\nodejs\node.exe Arguments: [C:\Program Files (x86)\Appium\node_modules\appium\bin\appium.js, --port, 4723, --address, 127.0.1.0, --log, C:\Users<UserName><Project>\log\androidLog.txt, --log-level, error, --robot-port, 4726, --nodeconfig, --session-override, --default-capabilities, {âappPackageâ: ââ, âappActivityâ: ââ, ânoResetâ: âfalseâ, âplatformVersionâ: ââ, âautomationNameâ: âUiAutomator2â, âplatformNameâ: âAndroidâ, âdeviceNameâ: ââ}]
Process output: 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: argument âânodeconfigâ: Expected one argument. null
Even on uncommenting the âcap.setCapability("ânodeconfig", ââ);â, Iâm still getting the same error.
Iâm trying to use the buildService method to start a server, but not exactly sure what arguments to give for the nodeconfig and its syntax. Any idea why this is happening ?
Any help is appreciated ! Thanks âŚ