Page 1 of 1
Access TextBox dynamically
Posted: Mon Apr 15, 2013 1:52 am
by bsing
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.
Re: Access TextBox dynamically
Posted: Mon Apr 15, 2013 3:54 pm
by Support Team
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
Re: Access TextBox dynamically
Posted: Tue Apr 16, 2013 12:17 am
by bsing
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??
Re: Access TextBox dynamically
Posted: Thu Apr 18, 2013 3:40 pm
by Support Team
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)
Re: Access TextBox dynamically
Posted: Mon Apr 22, 2013 6:00 am
by bsing
It almost works ... it finds the textbox below the header instead of above it (which is in a separate container)
Re: Access TextBox dynamically
Posted: Wed Apr 24, 2013 3:52 pm
by Support Team
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)