0

I have an application written in WinForms and it contains a single TextBox. With the TestComplete spy, I can spot the TextBox and its properties but during runtime, this control, in contrast to all the other controls, can't be spotted by its name or any of its other properties. Why is that and how can I fix it (either on the application side or the testing side)?

This is how the control is defined:

this.myTxtBx.BackColor = System.Drawing.SystemColors.InactiveBorder;
this.myTxtBx.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.myTxtBx.Location = new System.Drawing.Point(74, 25);
this.myTxtBx.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.myTxtBx.Name = "myTxtBox";
this.myTxtBx.Size = new System.Drawing.Size(91, 20);
this.myTxtBx.TabIndex = 1;
this.myTxtBx.TextChanged += new 
System.EventHandler(this.myTxtBox_TextChanged);

1 Answer 1

0

You need to map the object at runtime with objectmapper, give it an alias and use it in your script.

(TC has its own winapp driver protocol that reads the screen very much like W3Cs webdriver that all major browsers support to make automation possible).

Below is a js-function using WIX that finds an objectmapped form and enters a value (Your alias would probably be something like: Aliases.YourApp.myTxtBx.TextChanged):

function policeIdCheck() {
  var nomatch = "GC0000531";    
  var idnumform = Aliases.LraClient.ContentControl.ActionInfoContainerClearView.ContentControl.ActionInfoContainer.ItemsControl.IDDocNumberForm;
  if(idnumform.Exists) {      
    Log.Message("IDPolice Check");      
    idnumform.Keys(nomatch);
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.