Random Click on List Items

Mobile Testing, Android App Testing.
darius.popa
Posts: 20
Joined: Wed Jan 08, 2014 5:15 pm

Random Click on List Items

Post by darius.popa » Fri Jan 24, 2014 12:05 pm

Hello,

I have a list of elements and I want to do a random click on one of the elements and on another recording, to check if the selected element is correct.

My list looks like "/mobileapp[@title='com.mobileapp.mobile']/form[@title='Container']/container[@rid='content']//container[@rid='custom']/?/?/list[@rid='list']/?/?/text[@caption='TEXT_1']
The structure is:

Code: Select all

-List
    -Container
        -Text1
        -Text2
   -Container
        -Text1
        -Text2
   -Container
        -Text1
        -Text2
   -Container
        -Text1
        -Text2
First I want to select a random Text1 item from the list, to save it to a global variable and to check in another recording the the caption of the Text 1Item matches with a text.

I'm new with Ranorex, so any help is really appreciated.

THANK YOU!
Darius

mebner

Re: Random Click on List Items

Post by mebner » Tue Jan 28, 2014 3:05 pm

Hi Darius,

You could for instance save all the text elements to an IList in UserCode and then randomly access them by using the Random C# class.
To get all Text elements you could use one of the Find methods.
After you clicked it you can then save the text of the clicked element to your global parameter.

Regards,
Markus

darius.popa
Posts: 20
Joined: Wed Jan 08, 2014 5:15 pm

Re: Random Click on List Items

Post by darius.popa » Tue Feb 11, 2014 9:15 am

Thank you Markus! That worked.