Hi Praveen,
Thanks for response , after vacation back to work. Please ignore my previous code.
Below is working partially.
a) Able to kick start Appium server through code without any issues and it was perfectly running at 4788 port
Appiumcapabiliy.setCapability(“newCommandTimeout”,300);
CommandLine command = new CommandLine(“cmd”);
command.addArgument("/c");
command.addArgument(“C:\Program Files\nodejs\node.exe”);
command.addArgument(“D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\bin\appium.js”);
command.addArgument("–address");
command.addArgument(“127.0.0.1”);
command.addArgument("–port");
command.addArgument(“4788”);
command.addArgument("–no-reset");
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);
executor.execute(command, resultHandler);
After above statements I have placed below code to install App on the Emulator which was configured and detected fully.
File appDir = new File(“D://APPIUMWORK//android-sdk_r24.0.1-windows//android-sdk-windows//build-tools”);
File app = new File(appDir, “Vons_4.2.0.3_09Oct14.apk”);
Appiumcapabiliy.setCapability("automationname", "appium");
Appiumcapabiliy.setCapability("platformname","Android");
Appiumcapabiliy.setCapability(“platformVersion”,“4.2.2”);
Appiumcapabiliy.setCapability(“devicename”,“Nexus 7”);
Appiumcapabiliy.setCapability(CapabilityType.BROWSER_NAME,"");
Appiumcapabiliy.setCapability(“app-package”,“com.Safeway.client.android.vons”);
Appiumcapabiliy.setCapability(“app-activity”,“com.Safeway.client.android.ui.SplashScreen”);
Appiumcapabiliy.setCapability(“app”, app.getAbsolutePath());
ApUMDriver = new AndroidDriver (new URL("http://127.0.0.1:4788/wd/hub"),Appiumcapabiliy);
I am getting the message , device name is not provided.
Please see error description as mentioned below.
e[36minfoe[39m: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
e[36minfoe[39m: Appium REST http interface listener started on 127.0.0.1:4788
e[36minfoe[39m: [debug] Non-default server args: {“address”:“127.0.0.1”,“port”:4788,“noReset”:true}
e[36minfoe[39m: Console LogLevel: debug
e[36minfoe[39m: e[37m–>e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m e[90m{“desiredCapabilities”:{“newCommandTimeout”:300,“automationname”:“appium”,“platformVersion”:“4.2.2”,“app”:“D:\APPIUMWORK\android-sdk_r24.0.1-windows\android-sdk-windows\build-tools\Vons_4.2.0.3_09Oct14.apk”,“platformName”:“Android”,“browserName”:"",“app-package”:“com.Safeway.client.android.vons”,“devicename”:“Nexus 7”,“platformname”:“Android”,“app-activity”:“com.Safeway.client.android.ui.SplashScreen”}}e[39m
e[31merrore[39m: The following desired capabilities are required, but were not provided: deviceName
e[31merrore[39m: Failed to start an Appium session, err was: Error: The following desired capabilities are required, but were not provided: deviceName
e[36minfoe[39m: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
e[36minfoe[39m: [debug] Got configuration error, not starting session
e[36minfoe[39m: [debug] Cleaning up appium session
e[36minfoe[39m: [debug] Error: The following desired capabilities are required, but were not provided: deviceName
at Capabilities.checkValidity (D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\server\capabilities.js:139:13)
at Appium.configure (D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\appium.js:226:35)
at null. (D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\appium.js:106:10)
at Appium.start (D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\appium.js:117:5)
at Object.exports.createSession [as handle] (D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\lib\server\controller.js:182:16)
at next_layer (D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\express\lib\router\route.js:113:13)
at Route.dispatch (D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\express\lib\router\route.js:117:5)
at D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\express\lib\router\index.js:222:24
at Function.proto.process_params (D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\express\lib\router\index.js:288:12)
at next (D:\APPIUMWORK\APPIUMFORWIN\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\express\lib\router\index.js:216:19)
e[36minfoe[39m: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: deviceName)”,“origValue”:“The following desired capabilities are required, but were not provided: deviceName”},“sessionId”:null}
e[36minfoe[39m: e[37m<-- POST /wd/hub/session e[39me[31m500e[39me[90m 6.888 ms - 286e[39m e[90me[39m
Exception in thread “main” org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: deviceName) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.18 seconds
Build info: version: ‘2.44.0’, revision: ‘76d78cf’, time: ‘2014-10-23 20:03:00’
System info: host: ‘CSCINDAE751814’, ip: ‘10.31.24.67’, os.name: ‘Windows 7’, os.arch: ‘x86’, os.version: ‘6.1’, java.version: ‘1.7.0_71’
Driver info: io.appium.java_client.android.AndroidDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:153)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:109)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:39)
at com.Sample.Java.Sample.main(Sample.java:86)
Could you please guide me to resolve this issue?
Regards,
Kiran