Page 1 of 1

Identifying UI elements in an Android application

Posted: Wed Apr 27, 2016 1:42 pm
by Aloka
Hi,

Ranorex version: 5.4.5

Problem: Identifying UI elements in an Android application

Description of the problem:
There is a date time picker and the title is the current date and it is changing daily.
Therefore difficult to identify the UI elements.
Is there any solution to detect the UI element?

Example code:
form[@title=’ Wed, Apr 27, 2016’]/container[@rid='content']//button[@rid='button1']

Re: Identifying UI elements in an Android application

Posted: Wed Apr 27, 2016 2:29 pm
by odklizec
Hi,

Sure, you can overcome this problem by replacing the hardcoded date string with module variable and then fill that variable with actual date (via custom code).
So the xpath should look like this:

Code: Select all

form[@title=$date]/container[@rid='content']//button[@rid='button1']
Now the user code you need to run before accessing the above xpath should look like this:

Code: Select all

string dateFormat = " ddd, MMM dd, yyyy";  // date format like this: Wed, Apr 27, 2016
System.DateTime actualDate = System.DateTime.Today;  //get actual date  
date = returnDate.ToString(dateFormat); //convert obtained date to string
Where 'date' variable is the one defined in the module variable.

Re: Identifying UI elements in an Android application

Posted: Tue May 03, 2016 5:43 am
by Aloka
Than you. I'll try the solution.