Page 1 of 1

Random Click on List Items

Posted: Fri Jan 24, 2014 12:05 pm
by darius.popa
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

Re: Random Click on List Items

Posted: Tue Jan 28, 2014 3:05 pm
by mebner
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

Re: Random Click on List Items

Posted: Tue Feb 11, 2014 9:15 am
by darius.popa
Thank you Markus! That worked.