Some times Ranorex can't click on the permission dialog

Mobile Testing, Android App Testing.
thilina
Posts: 28
Joined: Wed Sep 03, 2014 12:32 pm

Some times Ranorex can't click on the permission dialog

Post by thilina » Tue Jul 11, 2017 1:30 pm

Some times Ranorex can't click on the android permission dialog.
patterns_permissions_runtime1.png
patterns_permissions_runtime1.png (82.15 KiB) Viewed 723 times

this how i find it
Capture.PNG
Capture.PNG (12.01 KiB) Viewed 723 times
P.S. Android OS automation = True

please tell us how to do it

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Some times Ranorex can't click on the permission dialog

Post by krstcs » Tue Jul 11, 2017 4:22 pm

I don't believe this particular dialog can be automated, even with Android OS Automation = true. It is a security feature of Android to keep nefarious apps from automating the process of giving permissions to the phone.
Shortcuts usually aren't...

thilina
Posts: 28
Joined: Wed Sep 03, 2014 12:32 pm

Re: Some times Ranorex can't click on the permission dialog

Post by thilina » Wed Jul 12, 2017 12:27 pm

when we are testing we have to install the app. after doing it prompts this. isn't there any workaround even ?

tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Re: Some times Ranorex can't click on the permission dialog

Post by tvu » Wed Jul 12, 2017 10:19 pm

I use ADB commands to interact with this pop up. A USB connection would be required.

For example, if you want to click "Allow" you must preform a down, right and then a center command.

You would do something like the following:
  • adb.exe -s ADB_DEVICE_NAME shell input keyevent KEYCODE_DPAD_DOWN
  • adb.exe -s ADB_DEVICE_NAME shell input keyevent KEYCODE_DPAD_RIGHT
  • adb.exe -s ADB_DEVICE_NAME shell input keyevent KEYCODE_DPAD_CENTER
You will need the ADB device name and not Ranorex's endpoint name.

*** Shout out to Kendall from Ranorex support for giving me this info. ***

thilina
Posts: 28
Joined: Wed Sep 03, 2014 12:32 pm

Re: Some times Ranorex can't click on the permission dialog

Post by thilina » Thu Jul 13, 2017 11:25 am

Yes, i'm also using following adb commands for permission

Code: Select all

adb shell pm grant pnl.order.dev android.permission.ACCESS_FINE_LOCATION	
adb shell pm grant pnl.order.dev android.permission.WRITE_EXTERNAL_STORAGE
adb shell pm grant pnl.order.dev android.permission.CAMERA
adb shell pm grant pnl.order.dev android.permission.CALL_PHONE
but unfortunately for android.permission.CALL_PHONE i get following error, that's why I had to use Ranorex.

Code: Select all

Operation not allowed: java.lang.SecurityException: Package pnl.order.dev has not requested permission android.permission.CALL_PHONE
Problem i'm having is few times clicking is success and most of the time it fails in automated environment. For localbox testing it is other way round.

thilina
Posts: 28
Joined: Wed Sep 03, 2014 12:32 pm

Re: Some times Ranorex can't click on the permission dialog

Post by thilina » Thu Jul 13, 2017 12:50 pm

I added

Code: Select all

<uses-permission android:name="android.permission.CALL_PHONE"/>
permission to AndroidManifest.xml file, and it solved that exception throwing when grant command.