Question

I want to run automation test on real devices, earlier i did this on emulators (API>17) but the same test i was trying to run on Appium in selendroid mode it failed.

Below is the capabilities i configured for appium to run in selendroid mode.

Appium Version : 1.0 Selendroid Version: 0.10

I run appium on port no : 6001 and bootstrap port : 4001, And selendroid server run on default port : 8080

private static String url = "http://localhost:"
            + System.getProperty("appium_port") + "/wd/hub";
private AppiumDriver driver;
private static DesiredCapabilities capabilities;



capabilities = new DesiredCapabilities();
File app = new File("en-android.apk");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Selendroid");
capabilities.setCapability(CapabilityType.PLATFORM, "ANDROID");
capabilities.setCapability("device", "Selendroid");
capabilities.setCapability("platformVersion", "4.1.2");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("app-activity",
        "testapp.android.gui.WelcomeActivity");
capabilities.setCapability("app-package",
        "testapp.android");

driver = new AppiumDriver(new URL(url), capabilities);

Below is Applium server logs.

Appium Log:

error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.
info: Stopping logcat capture
debug: Logcat terminated with code null, signal SIGTERM
info: Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
info: Cleaning up android objects
info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.
info: Error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.
    at /home/priyankpshah/.linuxbrew/lib/node_modules/appium/lib/devices/android/android.js:263:17
    at /home/priyankpshah/.linuxbrew/lib/node_modules/appium/lib/devices/android/adb.js:630:7
    at /home/priyankpshah/.linuxbrew/lib/node_modules/appium/lib/devices/android/adb.js:154:5
    at ChildProcess.exithandler (child_process.js:635:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Socket.<anonymous> (child_process.js:956:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.)","origValue":"Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device."},"sessionId":null}
POST /wd/hub/session 500 7269ms - 400b
Tests run: 4, Failures: 1, Errors: 0, Skipped: 3, Time elapsed: 8.198 sec <<< FAILURE! - in TestSuite
setUp(com.ishisystems.enigma.EnigmaLaunchTest)  Time elapsed: 8.084 sec  <<< FAILURE!
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 7.41 seconds
Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39'
System info: host: 'ishiahm-lt113', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-24-generic', java.version: '1.7.0_55'
Driver info: io.appium.java_client.AppiumDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:76)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:41)
    at TestUtility.automationInit(TestUtility.java:41)
    at LaunchTest.setUp(LaunchTest.java:33)

Please let me know is there any specific changes need to be made to run appium tests on selendroid mode on real devices.

Thanks, Priyank P Shah

Was it helpful?

Solution

If you are using Appium 1.0 use capability 'automationName' instead of device.

E.G.

capabilities.setCapability("automationName", "Selendroid");

instead of

capabilities.setCapability("device", "Selendroid");

For appium versions less than 1.0 beta , you can continue with 'device' capability.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top