Ask a Question

Different fields with same object name

SOLVED
romanmfs
Frequent Contributor

Different fields with same object name

Hi all!

 

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.

12 REPLIES 12
KSQian
Contributor

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.

 

romanmfs
Frequent Contributor

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;">

KSQian
Contributor

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?

SanderK
Occasional Contributor

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.

romanmfs
Frequent Contributor

How do I check if it has index property?...

SanderK
Occasional Contributor

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.

romanmfs
Frequent Contributor

Here is what I got. (see images).

 

Aslo i am only able to pick one property being checked. 

romanmfs
Frequent Contributor

Anybody?

SanderK
Occasional Contributor

It seems like Id and Name can be used to distinguish individual textboxes. I would map them based on their ObjectType and Id.

cancel
Showing results for 
Search instead for 
Did you mean: