Dynamic CheckBox

Class library usage, coding and language questions.
dal
Posts: 72
Joined: Thu Jun 24, 2010 8:59 am

Dynamic CheckBox

Post by dal » Thu Sep 02, 2010 12:43 pm

I have the following Check Boxes in my application (but its in dynamic in nature)

Main1 ChkBox
Sub11
Sub12
Sub13
Main2 ChkBox
Sub21
Sub22
Sub23

Is there a way to get all the CheckBox Items in a Table since its in the table, then by Indexing/by name of the CheckBox, I can click on the checkbox I want to Check.

When I try to record the objects, its identifying with @id property. But its in sequential in nature. If any new check box comes in between script may not play back as expected.

Any suggestions to overcome this issue..

Thanks in advance...

Regards,
Dalsingh

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Dynamic CheckBox

Post by Ciege » Thu Sep 02, 2010 4:10 pm

So in the table is Main1 and Main2 a cell in a row/column and then the checkbox is an adjacent cell in the same row as Main1 or Main2 respectively?

If so, you can write an RXPath that says something like

Code: Select all

MyCell1 = RanorexTable.FindSingle(".//row/cell[@accessiblevalue='Main1']/../cell[@accessiblename='ColumnNameWithCheckbox']", 120000);
MyCell2 = RanorexTable.FindSingle(".//row/cell[@accessiblevalue='Main2']/../cell[@accessiblename='ColumnNameWithCheckbox']", 120000);
Once you get the structure right, you can variablize the parameters, add it to a loop and then find each cell that has a check box next to its Main# value.

A little trick I picked up using the Ranorex produced screen casts...
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...