c# - Coded UI Testing: Textbox value always null -


i'm new coded ui testing, can me on how retrieve textbox value keep on getting null value. added assertion method validates value of textbox, if keeps on failing since actual data null. below sample code. in advance help.

here test method in codeuitest class

[testmethod]     public void tbparametertest()     {         this.uimap.validatetbvalue();                 }    public void validatetbvalue()     {         #region variable declarations         winedit uiitemedit = this.uicontigowindow.uiitemcell.uiitemedit;           #endregion          // verify 'text' property of text box equals '1200'         assert.areequal(this.validatetbvalueexpectedvalues.uiitemedittext, uiitemedit.text, "not equal previous value when parameter not yet modified");     } 

the uiitemedit.text null if value in webpage equal 1200.

thanks!

you can solve problem in 2 different ways:

  1. the better options adjust search properties search unique identifier (name, class...).

  2. the second option, in case unique identifier cannot found or added developers, using findmatchingcontrols() every uitestcontrol has. give controls, in case winedit controls match searchproperties. on collection of controls can run link queries find desired control, or run like:

var controls= mycontrol.findmatchingcontrols()l  foreach (var control in controls)  {      control.drawhighlight(); } 

this enable locate desired control. point on call directly , it's text value:

var textvalue = controls[index].text; 

and use value assertion.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -