Access TextBox dynamically

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
bsing
Posts: 81
Joined: Tue Feb 07, 2012 5:25 am

Access TextBox dynamically

Post by bsing » Mon Apr 15, 2013 1:52 am

Hi there,

Is there a way I can access a textbox in an array of textboxes dynamically based on a column header?

The structure I have is:

containerMain
container1
table
column[@text='Name']
container2
container
textbox (This is the textbox I want to refer to dynamically based on container1\table\column[@text='Name']

I have included a snapshot of the structure

Thanks,

Brad.
Attachments
FindSearchStructure.rxsnp
(360.05 KiB) Downloaded 186 times

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

Re: Access TextBox dynamically

Post by Support Team » Mon Apr 15, 2013 3:54 pm

Hi Brad,

I am not totally sure I completely got your question, but in order to select one of the textboxes "dynamically" you could use the "TabIndex" attribute which is equal to the "Index" attribute of the column.

Regards,
Markus
.
Image

bsing
Posts: 81
Joined: Tue Feb 07, 2012 5:25 am

Re: Access TextBox dynamically

Post by bsing » Tue Apr 16, 2013 12:17 am

Basically there is 2 child containers under the parent container. The first container has another child container that contains an array of textboxes. Under these textboxes is the 2nd child container which contains a table of columns and rows. When you drag the column headers horizontally the corresponding textbox moves with it. I need to refer to 'TTSign1' (see new attachment 'FindList.png') based on the column "Name" regardless of where it is moved to (dynamically).

This is easy to do if I refer to the textbox with a hardcoded TabIndex, but if the column header gets moved, it no longer refers to the "Name" column.

Based on the ranorex snapshot I provided how would I refer to 'TTSign1' dynamically with a RanoreXPath??
Attachments
FindList.png
FindList.png (4.49 KiB) Viewed 1509 times

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

Re: Access TextBox dynamically

Post by Support Team » Thu Apr 18, 2013 3:40 pm

Hello,

You could try to use the following path to get your column 'Name' even if it is moved:

Code: Select all

/form[@controlname='MainForm']//container[@controlname='listBorderControl']/table/column/cell[@text='Name']/../cell[@text='TTSign1']
Please try it out and let me know if this works in your case.
Thank you in advance.

Regards,
Markus (T)
.
Image

bsing
Posts: 81
Joined: Tue Feb 07, 2012 5:25 am

Re: Access TextBox dynamically

Post by bsing » Mon Apr 22, 2013 6:00 am

It almost works ... it finds the textbox below the header instead of above it (which is in a separate container)

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

Re: Access TextBox dynamically

Post by Support Team » Wed Apr 24, 2013 3:52 pm

Hello,

I am not sure if I got your use case completely.
Why do you want to access a textbox in that way?
Could you please describe step-by-step what you want to do?

Thank you in advance.

Regards,
Markus (T)
.
Image