org.openqa.selenium.SessionNotCreatedException: A new session could not be created - appium

I get this error when i run my appium test case, below is my program
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
public class Sample {
#Test
public void m1() throws MalformedURLException, InterruptedException{
// Create object of desired class and specify android platform
DesiredCapabilities capabilities = DesiredCapabilities.android();
// set the capabilities to execute in chrome browser
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);
// set capability to execute our test in Android platform
capabilities.setCapability(CapabilityType.PLATFORM, Platform.ANDROID);
// need to define platform name
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
// set device name
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "My Mobile");
// set version
capabilities.setCapability(CapabilityType.VERSION, "6.0");
// create object of url and assign appium server address
URL url = new URL("http://127.0.0.1:4723/wd/hub");
WebDriver driver = new AndroidDriver<>(url, capabilities);
driver.get("http://www.facebook.com");
System.out.println(driver.getTitle());
driver.findElement(By.name("email")).sendKeys("suhailxxxxx#gmail.com");
driver.findElement(By.name("pass")).sendKeys("xxxxxxxxx");
Thread.sleep(10000);
}
}
Below is the issue which i got in eclipse
FAILED: m1
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: spawn "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" ENOENT) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 11.87 seconds
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z'
System info: host: 'ACC-H-SUHAAHME', ip: '172.18.201.83', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_144'
Driver info: driver.version: 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:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:646)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:255)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:237)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:138)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:87)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:111)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:72)
at io.app.Sample.m1(Sample.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:756)
at org.testng.TestRunner.run(TestRunner.java:610)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
at org.testng.TestNG.runSuites(TestNG.java:1133)
at org.testng.TestNG.run(TestNG.java:1104)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
And this is the issue which i got on appium server
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it's already on the device
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" devices
info: [debug] 1 device(s) connected
info: Found device PBG6WSCEM7QSTK69
info: [debug] Setting device id to PBG6WSCEM7QSTK69
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" -s PBG6WSCEM7QSTK69 wait-for-device
info: [debug] Retrying restartAdb
info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" -s PBG6WSCEM7QSTK69 kill-server
info: [debug] Getting connected devices...
info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" -s PBG6WSCEM7QSTK69 devices
info: [debug] 1 device(s) connected
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" -s PBG6WSCEM7QSTK69 wait-for-device
info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" -s PBG6WSCEM7QSTK69 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Cleaning up appium session
error: Logcat capture failed: spawn "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" ENOENT
error: Failed to start an Appium session, err was: Error: spawn "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" ENOENT
info: [debug] Error: spawn "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1054:32)
at child_process.js:1145:20
at process._tickDomainCallback (node.js:381:11)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: spawn \"D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe\" ENOENT)","code":"ENOENT","errno":"ENOENT","syscall":"spawn \"D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe\"","path":"\"D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe\"","origValue":"spawn \"D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe\" ENOENT"},"sessionId":null}
info: <-- POST /wd/hub/session 500 10417.138 ms - 510

Please check you APPIUM server, it is started or not.

Update your appium server, node JS and npm then try it out. It worked for me, i was using appium server 1.4 after updating to version 1.7.1 it worked.

Can you close the current appium session and try again. If you are still seeing the error, what is your appium version

Related

Exception in thread "main" org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command

I am new in iOS automation and using Appium command line for this. I have script ready to launch the app(Integration app) in real device and Whenever I run the script in Eclipse, I keep getting the following error when running the scripts:
Exception in thread "main" org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command.
Original error: Could not install app: 'Command 'ios-deploy --id
f31936d8edc3b8f880254efd02006273e81f5b --bundle
/Users/eeposit/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Build/Products/Debug-iphonesimulator/IntegrationApp.app'
exited with code 253' (WARNING: The server did not provide any
stacktrace information)
Command duration or timeout: 9.97 seconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:14.666Z'
System info: host: 'eeposits-Mac-mini-2.local', ip: '192.168.0.106', os.name: 'Mac OS X', os.arch: 'x86_64', os.version:
'10.13.2', java.version: '9.0.1'
Driver info: driver.version: IOSDriver
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:476)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:83)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:93)
at io.appium.java_client.ios.IOSDriver.(IOSDriver.java:78)
at FirstiOS.iosautomate.main(iosautomate.java:43)
I have successfully installed the command [ npm install -g ios-deploy ] too but still the error is shown.
So, below are the capabilities that I have added.
capabilities.setCapability(MobileCapabilityType.APPIUM_VERSION, "1.7.2");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.3.3");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 5s");
capabilities.setCapability(MobileCapabilityType.UDID, "f31936d8edc3b8f880254efd02006273e81f5b");
capabilities.setCapability(MobileCapabilityType.APP, "/Users/eeposit/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Build/Products/Debug-iphonesimulator/IntegrationApp.app");
capabilities.setCapability("bundleId", "com.facebook.IntegrationApp");
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST);
Please go through the image of the appium logs too that I have attached here: Appium logs
[XCUITest] Error: Could not install app Command 'ios-deploy --id...exited with code 253
Any suggestions or help ?
It looks like you're attempting to install a simulator build onto a real device. You'll need to build for the proper architecture of the device that you want to test on, and then update your MobileCapabilityType.APP value to match. Something like:
"/Users/.../Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Build/Products/Debug-iphoneos/IntegrationApp.app");
This error message is discussed at some length in Appium's issue tracker here.

Appium-unhandled exception ENOENT is occuring

Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 23 --automation-name Appium --log-no-color
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"23","automationName":"Appium"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"capabilities":[{"desiredCapabilities":{"app":"C:/Users/yjaya/Desktop/app-release-unsigned.apk","platformName":"Android","deviceName":"Nexus","platformVersion":"6.0"}},{"requiredCapabilities":{}}],"desiredCapabilities":{"app":"C:/Users/yjaya/Desktop/app-release-unsigned.apk","platformName":"Android","deviceName":"Nexus","platformVersion":"6.0"},"requiredCapabilities":{}}
info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_131)
info: [debug] No appActivity desired capability or server param. Parsing from apk.
info: [debug] No appPackage desired capability or server param. Parsing from apk.
info: [debug] Using local app from desired caps: C:\Users\yjaya\Desktop\app-release-unsigned.apk
info: [debug] Creating new appium session f7d1277d-e625-4bc1-a4ad-4902bb5ed25b
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_131
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe
info: [debug] Parsing package and activity from app manifest
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\yjaya\AppData\Local\Android\sdk\build-tools\25.0.3\aapt.exe
info: [debug] Extracting package and launch activity from manifest.
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\build-tools\25.0.3\aapt.exe dump badging C:\Users\yjaya\Desktop\app-release-unsigned.apk
info: [debug] badging package: com.indsci.iassign
info: [debug] badging act: com.indsci.iassign.HomeActivity
info: [debug] Parsed package and activity are: com.indsci.iassign/com.indsci.iassign.HomeActivity
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 23
info: Device API level is: 23
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop persist.sys.language"
info: [debug] Current device persist.sys.language:
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\yjaya\Desktop\app-release-unsigned.apk" "C:\Users\yjaya\AppData\Local\Temp;C:\Program Files\Java\jre1.8.0_121\bin\com.indsci.iassign"
info: [debug] No strings.xml for language '', getting default strings.xml
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\yjaya\Desktop\app-release-unsigned.apk" "C:\Users\yjaya\AppData\Local\Temp;C:\Program Files\Java\jre1.8.0_121\bin\com.indsci.iassign"
warn: Error getting strings.xml from apk
info: [debug] Exception in thread "main" java.lang.Exception: Output is not an existing readable directory.
at io.appium.apktools.StringsXML.e(StringsXML.java:112)
at io.appium.apktools.Main.main(Main.java:23)
warn: Could not get strings, continuing anyway
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "echo '{}' > /data/local/tmp/strings.json"
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\yjaya\AppData\Local\Android\sdk\build-tools\25.0.3\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\build-tools\25.0.3\aapt.exe dump xmltree C:\Users\yjaya\Desktop\app-release-unsigned.apk AndroidManifest.xml
info: [debug] Set app process to: com.indsci.iassign
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for C:\Users\yjaya\Desktop\app-release-unsigned.apk.
info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" C:\Users\yjaya\Desktop\app-release-unsigned.apk
info: [debug] App already signed.
info: [debug] Zip-aligning C:\Users\yjaya\Desktop\app-release-unsigned.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Users\yjaya\AppData\Local\Android\sdk\build-tools\25.0.3\zipalign.exe
> error: Unhandled error: Error: ENOENT, no such file or directory 'C:\Users\yjaya\AppData\Local\Temp;C:\ProgramFiles\Java\jre1.8.0_121\bin\117522-13276-xudx2z'
at Error (native)
at Object.fs.mkdirSync (fs.js:747:18)
at tempDir (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\node_modules\appium-support\lib\tempdir.js:21:8)
at Object.generateName [as path] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\node_modules\appium-support\lib\tempdir.js:29:20)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:460:30)
at [object Object].ADB.checkSdkBinaryPresent (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:116:5)
at [object Object].ADB.checkZipAlignPresent (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:146:8)
at [object Object].ADB.zipAlignApk (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:457:8)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:496:10)
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5) context: [POST /wd/hub/session {"capabilities":[{"desiredCapabilities":{"app":"C:/Users/yjaya/Desktop/app-release-unsigned.apk","platformName":"Android","deviceName":"Nexus","platformVersion":"6.0"}},{"requiredCapabilities":{}}],"d]
Also have done adding Environment variables with sdk path..Still getting the above error.
Can anyone please help me on this.

Getting error when launching iOS device in appium

I have Xcode 8.2 version. I wrote the code in the eclipse and trying to run. I was able to install the ipa file but while trying to open the app, its not opening. Please find my code below -
package com.sampleiOS.com.sampleiOS;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
//import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
/**
* Unit test for simple App.
*/
public class AppTest
{
//public WebDriver driver;
public AppiumDriver<MobileElement> driver;
/**
* #return
* #return
* #return the suite of tests being tested
* #throws MalformedURLException
* #throws InterruptedException
*/
#Test
public void Rijo() throws MalformedURLException, InterruptedException
{
AppiumDriverLocalService service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/usr/local/opt/node/bin/node"))
.withAppiumJS(new File(
"/usr/local/lib/node_modules/appium/build/lib/main.js")));
//.withLogFile(new File("AppiumServerLogs/logs.txt")));
service.start();
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Ipod");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.3");
capabilities.setCapability(MobileCapabilityType.UDID, "4319165xxxxx");
capabilities.setCapability("app", "/Users/rijom/Downloads/xx.ipa");
capabilities.setCapability("automationName", "XCUITest");
driver = new IOSDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
Thread.sleep(5000);
}
}
Please find appium console log below -
[TestNG] Running:
/private/var/folders/hh/qx4s0ttd3zg3fn0w7g10hgt00000gs/T/testng-eclipse--1535528232/testng-customsuite.xml
[Appium] Welcome to Appium v1.6.0 (REV 0f37e2943bba265b42bb2087ea24b86dcc614c35)
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/status {}
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {"build":{"version":"1.6.0"...
[HTTP] <-- GET /wd/hub/status 200 23 ms - 121
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/rijom/Downloads/RSSFeedReader.ipa","automationName":"XCUITest","udid":"43191654cb4d510f9f3e75a1577fef3bff459859","platformName":"iOS","deviceName":"Ipod","platformVersion":"9.3"}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/rijom/Downl...
[Appium] Creating new XCUITestDriver session
[Appium] Capabilities:
[Appium] app: '/Users/rijom/Downloads/RSSFeedReader.ipa'
[Appium] automationName: 'XCUITest'
[Appium] udid: '43191654cb4d510f9f3e75a1577fef3bff459859'
[Appium] platformName: 'iOS'
[Appium] deviceName: 'Ipod'
[Appium] platformVersion: '9.3'
[debug] [XCUITest] XCUITestDriver version: 2.0.26
[BaseDriver] Session created with session id: ed58e7cb-1b46-42ca-aacf-c5edc9289573
[debug] [XCUITest] Xcode version set to '8.2'
[debug] [XCUITest] iOS SDK Version set to '10.2'
[debug] [XCUITest] Available devices: 43191654cb4d510f9f3e75a1577fef3bff459859
[debug] [XCUITest] Creating iDevice object with udid 43191654cb4d510f9f3e75a1577fef3bff459859
[XCUITest] Determining device to run tests on: udid: '43191654cb4d510f9f3e75a1577fef3bff459859', real device: true
[BaseDriver] Using local app '/Users/rijom/Downloads/RSSFeedReader.ipa'
[debug] [BaseDriver] Copying local zip to tmp dir
[debug] [BaseDriver] Unzipping /var/folders/hh/qx4s0ttd3zg3fn0w7g10hgt00000gs/T/201711-76306-k3wipf.ft3wok1emi/appium-app.zip
[debug] [BaseDriver] Testing zip archive: /var/folders/hh/qx4s0ttd3zg3fn0w7g10hgt00000gs/T/201711-76306-k3wipf.ft3wok1emi/appium-app.zip
[BaseDriver] Unzipped local app to '/var/folders/hh/qx4s0ttd3zg3fn0w7g10hgt00000gs/T/201711-76306-k3wipf.ft3wok1emi/Payload/RSSFeedReader.app'
[debug] [XCUITest] Checking whether app is actually present
[debug] [ios-app-utils] Getting bundle ID from app
[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[debug] [iOSLog] Found idevicesyslog: '/usr/local/bin/idevicesyslog'
[XCUITest] Setting up real device
[debug] [XCUITest] Stdout from app isInstalled check: [....] Waiting for iOS device to be connected
[....] Using iPod Touch 5G 'Ipod' (43191654cb4d510f9f3e75a1577fef3bff459859).
true
[debug] [XCUITest] App is installed.
[debug] [XCUITest] Full reset not requested. No need to install.
[XCUITest] Using default agent: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj
[XCUITest] Using default bootstrap: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: /usr/local/bin/carthage
[debug] [XCUITest] Beginning test with command '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/bin/run-xcodebuild.sh --project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj --scheme WebDriverAgentRunner --destination id=43191654cb4d510f9f3e75a1577fef3bff459859' in directory '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Waiting for WebDriverAgent to start on device
[debug] [XCUITest] Log file for xcodebuild test: /Users/rijom/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/B8534D7A-50CD-4B8A-8AD6-382B80BC7B84/Session-WebDriverAgentRunner-2017-02-01_154328-QrQMw9.log
[debug] [WebDriverAgent] Device: Feb 1 15:43:53 Ipod XCTRunner[493] <Warning>: Running tests...
[debug] [WebDriverAgent] Device: Feb 1 15:43:55 Ipod XCTRunner[493] <Warning>: Continuing to run tests in the background with task ID 1
[debug] [WebDriverAgent] Device: Feb 1 15:43:56 Ipod XCTRunner[493] <Warning>: Built at Feb 1 2017 15:43:37
[XCUITest] Detected that WebDriverAgent is running at url 'http://192.168.2.112:8100'
[debug] [WebDriverAgent] Device: Feb 1 15:43:57 Ipod XCTRunner[493] <Warning>: ServerURLHere->http://192.168.2.112:8100<-ServerURLHere
[XCUITest] WebDriverAgent started at url 'http://192.168.2.112:8100'
[debug] [XCUITest] Starting iproxy to forward traffic from local port 8100 to device port 8100 over USB
[debug] [WebDriverAgent] Device: Feb 1 15:43:57 Ipod XCTRunner[493] <Warning>: Listening on USB
[debug] [WebDriverAgent] Device: Feb 1 15:43:57 Ipod SpringBoard[48] <Warning>: HW kbd: Failed to set (null) as keyboard focus
[debug] [iProxy] bind(): Address already in use
[debug] [iProxy] Error creating socket: Address already in use
[XCUITest] Error: iproxy exited with code '208'
at SubProcess.<anonymous> (lib/webdriveragent.js:378:25)
at emitTwo (events.js:106:13)
at SubProcess.emit (events.js:191:7)
at ChildProcess.<anonymous> (lib/teen_process.js:191:14)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
Error: iproxy exited with code '208'
at SubProcess.<anonymous> (lib/webdriveragent.js:378:25)
at emitTwo (events.js:106:13)
at SubProcess.emit (events.js:191:7)
at ChildProcess.<anonymous> (lib/teen_process.js:191:14)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
[debug] [XCUITest] Running ios real device reset flow
[debug] [XCUITest] Resetting simulator
[debug] [iOSLog] Stopping iOS log capture
[MJSONWP] Encountered internal error running command: Error: iproxy exited with code '208'
at SubProcess.<anonymous> (lib/webdriveragent.js:378:25)
at emitTwo (events.js:106:13)
at SubProcess.emit (events.js:191:7)
at ChildProcess.<anonymous> (lib/teen_process.js:191:14)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
[HTTP] <-- POST /wd/hub/session 500 71554 ms - 166
FAILED: Rijo
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: iproxy exited with code '208' (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 71.82 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'Suvarnaratnas-Mac-mini.local', ip: '192.168.3.135', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.5', java.version: '1.8.0_45'
Driver info: io.appium.java_client.ios.IOSDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:36)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:114)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:132)
at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:77)
at com.sampleiOS.com.sampleiOS.AppTest.Rijo(AppTest.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================
===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================
[TestNG] Time taken by org.testng.reporters.EmailableReporter#6a5fc7f7: 85 ms
[TestNG] Time taken by org.testng.reporters.jq.Main#2d209079: 89 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter#2133c8f8: 14 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 4 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter#d041cf: 12 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter#7a79be86: 44 ms
I had updated the WebDriverAgentLib with my app Team and certificates also then its creating an new app as webDriverAgent but not opening my app. Could you help me how to open the app?
If there is a rogue iproxy session you can kill it by executing
ps -ax|grep -i "iproxy"|grep -v grep|awk '{print "kill -9 " $1}'|sh
on the command line.
iProxy is not exited, find the port and kill it.
To find the port:
lsof -i -n -P | grep 8100
To kill:
kill -9 PORT_NUMBER
copy this in terminal
export USE_PORT=8100
For real device, reconnect iOS cable and try running the code.

NullPointerException when using AndroidDriver and calling WebDriverWait

My code below tries to wait until our native app loads. But it receives NPE:
RemoteWebDriver driver =
new AndroidDriver<MobileElement>//this gets NPE below
//new RemoteWebDriver //this works!!
(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
new WebDriverWait(driver, 30).until(
ExpectedConditions.presenceOfElementLocated(
By.xpath("//*[contains(#text, 'Tan')]")));
When I replace AndroidDriver with RemoteDriver, everything works as expected! Our app launches and our test code waits until the app loads. The problem is, we cannot use mobile device specific API using RemoteDriver.
Appium GUI v1.4.16.1 (Ophiuchus). Please tell if any other version info is needed, as I'm not good at npm etc. But I downloaded all of the stuff last week.
Here is the stack trace:
java.lang.NullPointerException
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:152)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:636)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:369)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:56)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:474)
at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:134)
at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:361)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:52)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:895)
at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:41)
at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:181)
at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:178)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:238)
Here is what I see on Appium GUI:
> info: [debug] Appium session started with sessionId 4153c447-cfba-45db-a23a-1e603a3e0e7c
> info: <-- POST /wd/hub/session 303 17598.310 ms - 74
> info: --> GET /wd/hub/session/4153c447-cfba-45db-a23a-1e603a3e0e7c {}
> info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\\Temp\\appium\\akbank-release.apk","appActivity":"com.akbank.akbankdirekt.ui.prelogin.SplashActivity","platformName":"Android","deviceName":"OJOBUCIBGEKNTKYS"},"app":"C:\\Temp\\appium\\akbank-release.apk","appActivity":"com.akbank.akbankdirekt.ui.prelogin.SplashActivity","platformName":"Android","deviceName":"OJOBUCIBGEKNTKYS"},"sessionId":"4153c447-cfba-45db-a23a-1e603a3e0e7c"}
> info: <-- GET /wd/hub/session/4153c447-cfba-45db-a23a-1e603a3e0e7c 200 4.362 ms - 667 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\\Temp\\appium\\akbank-release.apk","appActivity":"com.akbank.akbankdirekt.ui.prelogin.SplashActivity","platformName":"Android","deviceName":"OJOBUCIBGEKNTKYS"},"app":"C:\\Temp\\appium\\akbank-release.apk","appActivity":"com.akbank.akbankdirekt.ui.prelogin.SplashActivity","platformName":"Android","deviceName":"OJOBUCIBGEKNTKYS"},"sessionId":"4153c447-cfba-45db-a23a-1e603a3e0e7c"}
> info: --> POST /wd/hub/session/4153c447-cfba-45db-a23a-1e603a3e0e7c/element {"using":"xpath","value":"//*[contains(#text, 'Tan')]"}
> info: [debug] Waiting up to 0ms for condition
> info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//*[contains(#text, 'Tan')]","context":"","multiple":false}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//*[contains(#text, 'Tan')]","context":"","multiple":false}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: find
> info: [debug] [BOOTSTRAP] [debug] Finding //*[contains(#text, 'Tan')] using XPATH with the contextId: multiple: false
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"Could not find an element using supplied strategy. ","status":7}
> info: [debug] Condition unmet after 8397ms. Timing out.
> info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Could not find an element using supplied strategy. "},"sessionId":"4153c447-cfba-45db-a23a-1e603a3e0e7c"}
> info: <-- POST /wd/hub/session/4153c447-cfba-45db-a23a-1e603a3e0e7c/element 500 8402.114 ms - 230
I've put a sleep before wait and now I don't get NPE:
RemoteWebDriver driver =
new AndroidDriver<MobileElement>//this gets NPE below
//new RemoteWebDriver //this works!!
(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
Thread.sleep(15000);
new WebDriverWait(driver, 30).until(
ExpectedConditions.presenceOfElementLocated(
By.xpath("//*[contains(#text, 'Tan')]")));
NPE was thrown as soon as the app was first loaded. I think this is an internal Appium problem.

Appium : UiAutomator quit before it successfully launched

Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 23 --automation-name Appium --log-no-color
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"23","automationName":"Appium"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"appPackage":"com.Honkampkrueger.hk","appActivity":".MainActivity","app":"C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk","browserName":"","platformName":"Android","deviceName":"Android Emulator","version":"4.4.2"}}
info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_71)
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version
info: [debug] Using local app from desired caps: C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk
info: [debug] Creating new appium session f2eb01fe-7b8c-4e7c-89c6-5d776471a569
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_71
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Program Files\SDK\platform-tools\adb.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 wait-for-device
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "getprop persist.sys.language"
info: [debug] Current device persist.sys.language: en
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk" "C:\Users\KULDEE~1.SAH\AppData\Local\Temp\com.Honkampkrueger.hk" en
info: [debug] No strings.xml for language 'en', getting default strings.xml
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk" "C:\Users\KULDEE~1.SAH\AppData\Local\Temp\com.Honkampkrueger.hk"
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 push "C:\Users\KULDEE~1.SAH\AppData\Local\Temp\com.Honkampkrueger.hk\strings.json" /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Program Files\SDK\build-tools\23.0.2\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: "C:\Program Files\SDK\build-tools\23.0.2\aapt.exe" dump xmltree C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk AndroidManifest.xml
info: [debug] Set app process to: com.Honkampkrueger.hk
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk.
info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk
info: [debug] App already signed.
info: [debug] Zip-aligning C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Program Files\SDK\build-tools\23.0.2\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: "C:\Program Files\SDK\build-tools\23.0.2\zipalign.exe" -f 4 C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk C:\Users\KULDEE~1.SAH\AppData\Local\Temp\11615-3480-14zot2k\appium.tmp
info: [debug] MD5 for app is 91f72bc7e64a758cdb9d0b8414bd853c
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/91f72bc7e64a758cdb9d0b8414bd853c.apk"
info: [debug] Getting install status for com.Honkampkrueger.hk
info: [debug] Getting device API level
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "pm list packages -3 com.Honkampkrueger.hk"
info: [debug] App is not installed
info: Installing App
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "mkdir -p /data/local/tmp/"
info: [debug] Removing any old apks
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/*.apk"
info: [debug] Found an apk we want to keep at /data/local/tmp/91f72bc7e64a758cdb9d0b8414bd853c.apk
info: [debug] Couldn't find any apks to remove
info: [debug] Uninstalling com.Honkampkrueger.hk
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "am force-stop com.Honkampkrueger.hk"
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 uninstall com.Honkampkrueger.hk
info: [debug] App was not uninstalled, maybe it wasn't on device?
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "pm install -r /data/local/tmp/91f72bc7e64a758cdb9d0b8414bd853c.apk"
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
info: Starting App
info: [debug] Attempting to kill all 'uiautomator' processes
info: [debug] Getting all processes with 'uiautomator'
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "ps 'uiautomator'"
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: C:\Program Files\SDK\platform-tools\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.Honkampkrueger.hk -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: shortMsg=java.lang.NullPointerException
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: longMsg=null
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_CODE: 0
info: [debug] UiAutomator exited
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ping'"
info: [debug] Attempting to uninstall app
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
error: UiAutomator quit before it successfully launched
error: Failed to start an Appium session, err was: Error: UiAutomator quit before it successfully launched
info: [debug] Error: UiAutomator quit before it successfully launched
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:205:23)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-hybrid.js:249:5)
at Object.async.eachSeries (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:142:20)
at [object Object].androidHybrid.stopChromedriverProxies (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-hybrid.js:233:9)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:200:10)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:222:9)
at [object Object].androidCommon.uninstallApp (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:478:5)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:220:12)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:229:11)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:901:7
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: UiAutomator quit before it successfully launched)","origValue":"UiAutomator quit before it successfully launched"},"sessionId":null}
info: <-- POST /wd/hub/session 500 46111.400 ms - 218
Error : Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: UiAutomator quit before it successfully launched) (WARNING: The server did not provide any stacktrace information).
Anyone have solution of this as My running emulator is very slow to launch.
UiAutomator quit before it successfully launched error: Failed to
start an Appium session, err was: Error: UiAutomator quit before it
successfully launched info: [debug] Error: UiAutomator quit before it
successfully launched at [object Object]. (C:\Program Files
(x86)\Appium\node_modules\appium\lib\devices\android\android.js:205:23)
at [object Object].
These suggests that UIAutomator did not launch due to which Appium session was not created. [SessionNotCreatedException on your IDE]
Restarting adb server and appium serve shall help you.
Prior to that you can also try running the UIAutomator using shell to verify if its working alright on your machine.
In case you using Appium 1.4 + version to automate android (7.0 / N / Nougat ) version, this issue persists. you have to make couple of changes to get this working properly.
We had a similar issue, when we started to automate a simple mobile application using appium, android studio and selenium webdriver, after so many searches and also looking at various appium support tickets, we found that it was a bug and they have given an alternative to fix and go ahead.
You have to change code in couple of places in following file:
C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js
Those details have been listed in below article:
http://www.testingtools.co/appium/error-command-failed-adb-exe-s-emulator-5554-shell-ps-uiautomator
Hope it helps you, in case you have any queries, you can post them over the blog article in form of comments as well.
You cannot run UIAutomator and Appium server in parallel, this is known issue. Make sure your Appium server is stopped before you run your UIAutomator then try again. This should work.

Resources