Forum Discussion

abrar22's avatar
abrar22
Frequent Contributor
10 years ago

Same textbox name testcomplete

I have more than 2 textbox in window. 

 

1. WPFObject("TransitionElement", "", 1).WPFObject("TextBox", "", 1)

2: WPFObject("ConditionalContent", "", 1).WPFObject("TextBox", "", 1)

 

I want to enter something in 2nd text box but its entering the value in 1st text box. I am using following code:

 

this.barValue= this.winCubeForm.FindChild("Name",'WPFObject("TextBox", "", 1))',MAX_CHILDREN);;
{
if(this.barValue.Exists){
this.barValue.Keys("1.1" + "[Enter]");
}else {
Log.Error("barValue");
}
}

 

Whats the best way to differntiate between objects with same name?

 

Thanks

 

  • The only thing that distinguishes one object from the other is the parent object.

     

    Change this one line:

     

    this.barValue= this.winCubeForm.FindChild("Name",'WPFObject("TextBox", "", 1))',MAX_CHILDREN);;

     

    To this:

     

    this.barValue= this.winCubeForm.FindChild(Array("Parent.Name", "Name"),Array("WPFObject('TransitionElement', '', 1)", "WPFObject('TextBox', '', 1)"),MAX_CHILDREN);;

     

    Let me know if this helps.

     

     

  • The only thing that distinguishes one object from the other is the parent object.

     

    Change this one line:

     

    this.barValue= this.winCubeForm.FindChild("Name",'WPFObject("TextBox", "", 1))',MAX_CHILDREN);;

     

    To this:

     

    this.barValue= this.winCubeForm.FindChild(Array("Parent.Name", "Name"),Array("WPFObject('TransitionElement', '', 1)", "WPFObject('TextBox', '', 1)"),MAX_CHILDREN);;

     

    Let me know if this helps.