Automating a native app using Appium/Selendroid

272 views
Skip to first unread message

Vincent Airiau

unread,
Mar 23, 2016, 3:59:31 PM3/23/16
to robotframework-users
Hi,
I'm currently trying to automate a simple youtube navigation using Appium. I got it working for 4.2+ android devices, but can't get it to for a Samsung Galaxy S2 under 4.0.4.
Selendroid is properly launched but I have this error when tryin to open the session: "[Selendroid] Error: Could not find app apk at 'undefined'"

Here are the capabilities passed to the session:
automationName: 'Selendroid'
platformName: 'Android'
deviceName: 'Samsung Galaxy S2'
appActivity: '.HomeActivity'
appPackage: 'com.google.android.youtube'

From what I would understand, it seems that Selendroid doesn't work by default with native apps. Is there a way to switch to a native context using Robotframework-appium?

Thank you

Jari Nurminen

unread,
Mar 24, 2016, 3:05:17 AM3/24/16
to doe...@gmail.com, robotframework-users
Hi,
 
Youtube is pre-installed on the device, correct? 
I guess the problem is that selendroid tries to install the apk before the tests (check the appium server logs, you should be able to see what appium/selendroid is trying to do before it fails)
 
a couple of ideas to try with:
1) browse through the appium documentation and look for "*reset*" caps (e.g. noReset, fullReset etc.)
The Appium documentation is pretty confusing about. As far as I can remember the documentation does not differentiate between pre-installed (i.e. no apk available) and self-developed (i.e. apk available) = it's pretty difficult to figure out what happens in which scenario --> try different combinations of the relevant caps 
 
2)
download the apk from your device and let seledroid (re)install before automating it.
 
cheerio,
Jari
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Vincent Airiau

unread,
Mar 24, 2016, 6:45:13 AM3/24/16
to robotframework-users, doe...@gmail.com, jari...@gmail.com
Hi Jari and thank you for your answer.

I played around a bit with the reset caps but it didn't seem to have an effect on selendroid, it's still looks like it's searching for an apk to install in each case.
You are right in saying that the Appium doc isn't very talkative on this subject, apart from saying to check out Selendroid doc.

When passing the 'app' cap, Selendroid retrieves the value (as the 'aut' cap I guess). My guess is that appium might not have included native context in its way to use selendroid (or that it's waiting for a value that is not described in the doc).

I might just end up working with an apk and save me the trouble...

Here is the full log on appium side:
2016-03-24 09:57:33:379 - info: [Appium] Welcome to Appium v1.5.0
2016-03-24 09:57:33:382 - info: [Appium] Non-default server args:
2016-03-24 09:57:33:383 - info: [Appium]   port: 50201
2016-03-24 09:57:33:384 - info: [Appium]   log: 'log_node_50201.log'
2016-03-24 09:57:33:384 - info: [Appium]   logTimestamp: true
2016-03-24 09:57:33:386 - info: [Appium]   nodeconfig: 'node_50201_SGN2.json'
2016-03-24 09:57:33:442 - info: [debug] [Appium] Starting auto register thread for grid. Will try to register every 5000 ms.
2016-03-24 09:57:33:443 - info: [Appium] Appium REST http interface listener started on 0.0.0.0:50201
2016-03-24 09:57:37:458 - info: [HTTP] --> GET /wd/hub/status
2016-03-24 09:57:37:470 - info: [MJSONWP] Calling AppiumDriver.getStatus() with args: []
2016-03-24 09:57:37:488 - info: [MJSONWP] Responding to client with driver.getStatus() result: {"build":{"version":"1.5.0","revision":null}}
2016-03-24 09:57:37:497 - info: [HTTP] <-- GET /wd/hub/status 200 35 ms - 83
2016-03-24 09:57:38:485 - info: [debug] [Appium] Appium successfully registered with the grid on 127.0.0.1:50200
2016-03-24 09:57:39:279 - info: [HTTP] --> POST /wd/hub/session
2016-03-24 09:57:39:299 - info: [MJSONWP] Calling AppiumDriver.createSession() with args: [{"automationName":"Selendroid","platformName":"Android","fullReset":"true","deviceName":"Samsung Galaxy S2","appActivity":".HomeActivity","udid":"...
2016-03-24 09:57:39:303 - info: [Appium] Creating new SelendroidDriver session
2016-03-24 09:57:39:303 - info: [Appium] Capabilities:
2016-03-24 09:57:39:321 - info: [Appium]   automationName: 'Selendroid'
2016-03-24 09:57:39:321 - info: [Appium]   platformName: 'Android'
2016-03-24 09:57:39:321 - info: [Appium]   fullReset: 'true'
2016-03-24 09:57:39:322 - info: [Appium]   deviceName: 'Samsung Galaxy S2'
2016-03-24 09:57:39:322 - info: [Appium]   appActivity: '.HomeActivity'
2016-03-24 09:57:39:323 - info: [Appium]   udid: '0019272331358e'
2016-03-24 09:57:39:323 - info: [Appium]   appPackage: 'com.google.android.youtube'
2016-03-24 09:57:39:326 - info: [debug] [Appium] Capability 'fullReset' changed from string to boolean. This may cause unexpected behavior
2016-03-24 09:57:39:334 - info: [BaseDriver] Session created with session id: 4285bc98-f3af-4a17-866e-f405833db4e1
2016-03-24 09:57:39:336 - info: [debug] [Selendroid] Checking whether app is actually present
2016-03-24 09:57:39:357 - error: [Selendroid] Error: Could not find app apk at 'undefined'
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at SelendroidDriver.checkAppPresent$ (lib/driver.js:238:14)
    at tryCatch (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at run (/usr/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:104:47)
    at /usr/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:115:28
    at flush (/usr/lib/node_modules/appium/node_modules/core-js/library/modules/$.microtask.js:19:5)
    at _combinedTickCallback (node.js:376:9)
    at process._tickCallback (node.js:407:11)
 [Error: Could not find app apk at 'undefined']
2016-03-24 09:57:39:358 - info: [debug] [Selendroid] Deleting Selendroid session
2016-03-24 09:57:39:360 - error: [MJSONWP] Encountered internal error running command: Error: Could not find app apk at 'undefined'
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at SelendroidDriver.checkAppPresent$ (lib/driver.js:238:14)
    at tryCatch (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at run (/usr/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:104:47)
    at /usr/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:115:28
    at flush (/usr/lib/node_modules/appium/node_modules/core-js/library/modules/$.microtask.js:19:5)
    at _combinedTickCallback (node.js:376:9)
    at process._tickCallback (node.js:407:11)
2016-03-24 09:57:39:364 - info: [HTTP] <-- POST /wd/hub/session 500 82 ms - 174
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Vincent Airiau

unread,
Mar 24, 2016, 7:08:21 AM3/24/16
to robotframework-users, doe...@gmail.com, jari...@gmail.com
Alright so, after some search it seems to me that Selendroid does not support already installed apps like Appium does. I tried to pull the youtube app and let selendroid reinstall it but it does not have the proper permission to do it.
Reply all
Reply to author
Forward
0 new messages