Interact with the system permission popup

Mobile Testing, Android App Testing.
CataTester
Posts: 7
Joined: Fri Aug 19, 2016 10:56 am

Interact with the system permission popup

Post by CataTester » Wed Sep 07, 2016 10:08 am

Hello,

I am using Windows 7 and Ranorex version 6.0.2
I am automating an Android application on Android 6.

In my app, the user goes to an activity that contains a camera view, and the Android permission system popup is triggered.
Is Ranorex allowed to interact with the permission system popup ?
Such as : file / camera / contacts permission popup :
Android_system_permission_popup.png
Android_system_permission_popup.png (12.11 KiB) Viewed 1268 times
With Ranorex Spy, I am currently not able to see the screen that contains the system popup.
The screen is displayed completely greyed, the permission popup is not displayed to be analyzed :
Ranorex_spy_Android_system_permission_popup.png
Ranorex_spy_Android_system_permission_popup.png (1.35 KiB) Viewed 1268 times
And during a Ranorex recording, touching the "ALLOW" or "DENY" button of the popup is not registered as a new action.

Please also note, when I "spy" my android application with the uiautomatorviewer of Android SDK, I can see the permission popup and select it to get its ressource id.

Is it the Android system that prevents Ranorex from interacting on a system popup ?
Is this a limitation of Ranorex ?
There is known a workaround ?

Thank you very much.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3945
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Interact with the system permission popup

Post by odklizec » Wed Sep 07, 2016 12:24 pm

Hi,

I believe you need to enable "Android OS Automation" option in Ranorex 'Settings' >> 'Plugins' tab >> 'Mobile' section, as described here:
http://www.ranorex.com/support/user-gui ... -apps.html

Also, you will have to add the action/element manually, as Recording of system apps is not possible.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

CataTester
Posts: 7
Joined: Fri Aug 19, 2016 10:56 am

Re: Interact with the system permission popup

Post by CataTester » Wed Sep 07, 2016 1:25 pm

Hello,

Thank you for your quick feedback on this.

I have already enabled the "Android OS Automation" parameter, I tried with ("True") and without ("False"), the result is the same in Ranorex Spy (the view is greyed and I cannot search manually for an element of the system permission popup).

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3945
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Interact with the system permission popup

Post by odklizec » Wed Sep 07, 2016 1:57 pm

Are you connected via USB? It will not work with wifi connection.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

CataTester
Posts: 7
Joined: Fri Aug 19, 2016 10:56 am

Re: Interact with the system permission popup

Post by CataTester » Wed Sep 07, 2016 2:59 pm

Yes, I am connected to my Android device (a Nexus 5) with an USB cable.

Note that I can't access Android settings neither with Ranorex Spy (Even if "Android OS Automation" parameter is set to "True).

What kind of information should I add/share to help ?

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Interact with the system permission popup

Post by asdf » Wed Sep 14, 2016 8:21 am

Hi CataTester,

Please ensure that you set the "Screenshot on AndroidOS" flag to false and the "Android OS Automation" to true.
I tried it with my Nexus 5x and Android 7 and it works like expected.

I hope this helps.

Sincerely,
asdf
Last edited by asdf on Thu Sep 15, 2016 9:28 am, edited 1 time in total.

CataTester
Posts: 7
Joined: Fri Aug 19, 2016 10:56 am

Re: Interact with the system permission popup

Post by CataTester » Thu Sep 15, 2016 9:12 am

Hello asdf,

Thank you for your help, I have followed your advice but I am still having the problem in the Ranorex Spy.

Regardless of the settings configuration about Android OS Automation ("Android OS Automation" to TRUE or FALSE / "Screenshot on AndroidOS" to TRUE or FALSE), the result is always the same : the Ranorex Spy view is still grey and I don't see the different elements composing a system screen or a system popup.

Maybe this problem is specific to the Nexus 5 with Android 6.0.1 ? :/

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Interact with the system permission popup

Post by Support Team » Fri Sep 16, 2016 2:10 pm

Hi CataTester,

In order to analyze your issue in more detail, I would suggest sending an email to [email protected] with a detailed description of your problem.

We could arrange a remote session, in order to discuss your problem, if it's necessary.

I'm looking forward to your email.

Sincerely,
Matthias
.
Image

CataTester
Posts: 7
Joined: Fri Aug 19, 2016 10:56 am

Re: Interact with the system permission popup

Post by CataTester » Mon Oct 03, 2016 3:46 pm

Hello Matthias,

I've been in contact with someone from the Support Team.
To help the community about the problem I've been into, here is the explanation that have been given to me:
Ranorex is able to connect to a single application through the adb interface. In every case this is the active instrumented application. So if you have an instrumented application in foreground you can only do automation on this application, therefore you are not able to click on an android system popup.

If there is no instrumented application in foreground, Ranorex Studio switches to Android OS automation (if enabled), in this case you are able to click on Android OS popups.

You could test this by yourself with an open Ranorex Spy. If you open your application under test the connection the device should be listed as "MobileApp". If you send your application to the background and refresh the Ranorex Spy it should switch to "Android OS". This switch may take a while (~30 seconds).
TL;DR
Ranorex is able to interact with only one application at a time, so if Ranorex is focused on your app, then it cannot automate the Android OS. To automate the Android OS, your app must be in the background.

Thank you,
Best Regards.