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:
the better options adjust search properties search unique identifier (name, class...).
the second option, in case unique identifier cannot found or added developers, using
findmatchingcontrols()
everyuitestcontrol
has. give controls, in casewinedit
controls matchsearchproperties
. 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
Post a Comment