Different fields with same object name
Need help with this problem.
I have a box with bunch of fields containing a customer information (web app) that turned out to have same object names.
Is there a way to differentiate these fields even though they are named the same way (same object).
I am trying to set up different checkpoints on the text the fields contain but since they all named the same way my checkpoints do not work.
See screenshots, thanks.
Solved! Go to Solution.
lol. What is the DOM like?
For example in Chrome, you can right click an element and click on 'inspect' and that can take you to the DOM.
Maybe its like
<li> <label>First Name</label> <input name='field' > </input> </li> <li> <label>Last Name</label> <input name='field' > </input> </li> <li> <label>Email</label> <input name='field' > </input> </li>
You see, each input has the same name, but their label may be different. In this case, you find the label first, go up to the parent then drill back down to the child.
var EmailLabel = dom.Find("Label","Email")
var EmailField = EmailLabel.Parent.Find("input", "field")
Something like that.I don't use TC for web testing so this is high level pseudo code. But it should follow this pattern I think.
I am doing simple keyword editing and thats the example of the field when I click inspect.
It doesnt have a label tag, even if I find it I am not sure how am i suppose to implement it/ rename object??
<input type="text" size="20" autocomplete="off" id="ext-comp-2500" name="email_address" class=" x-form-text x-form-field " style="width: 173px;">
What i meant is look around the parent, siblings.
Are any of the parents or siblings named? Can you find it contextually?
Edit : Judging by a screenshot, there's obviously a label on the form. How could there be no labels?
Do the fields have an Index property? In that case you can map them based on their type and index on the page as long as they always appear in the same order.
How do I check if it has index property?...
Open the checkpoint wizard, choose Object property and drop the crosshair on one of the fields. Then click Next and Advanced and you'll get a list of all the field's properties and their values.
It seems like Id and Name can be used to distinguish individual textboxes. I would map them based on their ObjectType and Id.