Cannot get the ressource id of Android elements with Ranorex

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

Cannot get the ressource id of Android elements with Ranorex

Post by CataTester » Fri Aug 19, 2016 1:33 pm

Hello,

I am using Windows 7 and Ranorex version 6.0.2

When I "spy" my android application with Ranorex Spy, the listed elements (texts, buttons, lists ...etc) don't have their ressource id displayed in the Ranorex software (the ressource-id field is always displayed as empty). I tried with all the different instrumentation settings.

Please note, when I "spy" my android application with the uiautomatorviewer of Android SDK, I can see the ressource id of every elements defined by the developer. So I know that the ressource id of these elements exists.

With Ranorex Spy, I would like to be able to get the ressource id of the elements of my Android application in order to write precise Xpath with the ressource id of the element.
But as Ranorex Spy can't see the ressource id, I can't build such type of Xpath even if I know their ressource id (known thanks to uiautomatorviewer of Android SDK.)

Note that, if I use the KeyPassDroid Android application sample with Ranorex Spy, the ressource id of Android elements are displayed, and Xpath are automatically created with the ressource id of the element.

As the uiautomatorviewer of Android SDK is able to see the ressource id, why Ranorex Spy cannot find the ressource id of the elements ?

I am not allowed not post any snapshot of my Android application in this public forum (If you ask me to, could you please give me an address email where I can sent it to you).

Thank you very much.

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

Re: Cannot get the ressource id of Android elements with Ranorex

Post by Support Team » Mon Aug 22, 2016 2:54 pm

Hello CataTester,

I assume that you use a custom R.id package. If this is the case, you will need to provide a custom class name for locating resource ids (for example, com.ranorex.demo.R). By default Ranorex will search the id in <manifestpackage>.R.

This option needs to be declared during the instrumentation process in the settings dialog.
instrumentation_wizard.png
instrumentation_wizard.png (35.92 KiB) Viewed 1302 times
instrumentation_settings.png
instrumentation_settings.png (12.44 KiB) Viewed 1302 times
Please do let me know if this resolves the issue.

Sincerely,
Johannes
.
Image

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

Re: Cannot get the ressource id of Android elements with Ranorex

Post by CataTester » Mon Aug 29, 2016 10:00 am

Hello Johannes,

Yes, thank you, this solves perfectly my problem.
The developers of the application are using a custom path for the ressources (which is not the package name of the application).

Now, I am able to get the ressource id of the elements and I can write precise Xpath with the ressource id of these elements.

Again, thank you.

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

Re: Cannot get the ressource id of Android elements with Ranorex

Post by tvu » Wed Oct 19, 2016 11:04 pm

We use a custom R.id package for our project as well. We were able to find our rIDs after adding in our custom R.id package name. Unfortunately, we have some button elements that are defined by the Android framework itself and not by application. The IDs for these buttons are blank.

Can we specify multiple custom R.id packages when instrumenting our app via the Wizard?

diogogmaio
Posts: 33
Joined: Thu May 19, 2016 4:52 pm

Re: Cannot get the ressource id of Android elements with Ranorex

Post by diogogmaio » Thu Nov 17, 2016 12:47 pm

This solution work for automating firefox apk mobile?

User avatar
RobinHood42
Posts: 240
Joined: Fri Jan 09, 2015 3:24 pm

Re: Cannot get the ressource id of Android elements with Ranorex

Post by RobinHood42 » Fri Nov 18, 2016 3:59 pm

Hi diogogmaio,

What do you mean? Native browsers are not supported by Ranorex. Please be more specific.

Cheers,
Robin

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

Re: Cannot get the ressource id of Android elements with Ranorex

Post by odklizec » Fri Nov 18, 2016 4:06 pm

Hi Robin,

He posted a similar question >here< and I believe it's 'solved' now ;)
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