visual studio 2012 - How to know control ID based on searched InnerText/Name -


public class uirow0jqxgrid1pane : htmldiv     {          public uirow0jqxgrid1pane(uitestcontrol searchlimitcontainer) :                  base(searchlimitcontainer)         {             #region search criteria             this.searchproperties[htmldiv.propertynames.id] = "row0jqxgrid1";//this id dynamic. need search based on provided innertext             this.searchproperties[htmldiv.propertynames.name] = null;             this.filterproperties[htmldiv.propertynames.innertext] = "xxxx";             this.filterproperties[htmldiv.propertynames.title] = null;             this.filterproperties[htmldiv.propertynames.class] = null;             this.filterproperties[htmldiv.propertynames.controldefinition] = "id=\"row0jqxgrid1\" role=\"row\" style=\"height: 25px; ;\"";             this.filterproperties[htmldiv.propertynames.taginstance] = "696";             this.windowtitles.add("test");             #endregion         }          #region properties         public htmldiv uialmondestateconsultapane         {                         {                 if ((this.muialmondestateconsultapane == null))                 {                     this.muialmondestateconsultapane = new htmldiv(this);                     #region search criteria                     this.muialmondestateconsultapane.searchproperties[htmldiv.propertynames.id] = null;                     this.muialmondestateconsultapane.searchproperties[htmldiv.propertynames.name] = null;                     this.muialmondestateconsultapane.filterproperties[htmldiv.propertynames.innertext] = "xxxx";                     this.muialmondestateconsultapane.filterproperties[htmldiv.propertynames.title] = null;                     this.muialmondestateconsultapane.filterproperties[htmldiv.propertynames.class] = null;                     this.muialmondestateconsultapane.filterproperties[htmldiv.propertynames.controldefinition] = "style=\"text-align: left;  padding-bottom: 2px; margin- " +                         "margin-right: 2px; margin- -ms-text-\"";                     this.muialmondestateconsultapane.filterproperties[htmldiv.propertynames.taginstance] = "700";                     this.muialmondestateconsultapane.windowtitles.add("test;                     #endregion                 }                 return this.muialmondestateconsultapane;             }         }         #endregion          #region fields         private htmldiv muialmondestateconsultapane;         #endregion     } 

scenario ____ above code generated when select item grid. notice items identified 'pane' in grid. different scenario have select different item. input value stored in file pick 1 value , pass test method.

what want ____ need find row id of grid based on provided value, mouse click happen on row.

what did ____ grid populate data retrieve database. can't assume value have row id. have change innertext searchproperty playback stop , test fail.

what notice in html ____the html structure this

<grid id="grid1" style="....">   <div>header row definition</div>   <div> data row     <div id="gridrow0" style="...">a</div>     <div id="gridrow1" style="...">b</div>     <div id="gridrow2" style="...">c</div>     <div id="gridrow3" style="...">d</div>     .......     ......   </div> </grid> 

please give solution...i did not find clue...

thanks time...

i'd refactor code. you've got id of row in html, let's use that. testbuilder tends make things bit more difficult read , includes many properties make searching efficient or meaningful.

so, .uitest file has 2 sub classes: .designer.cs (where code above located), , .cs file. open .cs file , locate row doing like:

public htmldiv gridrow(int index) {      htmldiv target = new htmldiv(browser);      target.searchproperties.add(htmldiv.propertyname.id, "gridrow" + index.tostring());      return target; } 

then, in test, if want row, call mymap.gridrow(2) htmldiv of particular row.

then, if you've got hyperlink, example, within row, in map create object:

public htmlhyperlink linkonrow(int index) {     htmlhyperlink target = new htmlhyperlink(gridrow(index));     target.searchproperties.add(htmlhyperlink.propertynames.[your prop], [your value]);     return target; } 

still, if wanted use innertext, you'd change propertyname.id propertyname.innertext , use value instead.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -