Wrong value in Run Selection mode !

Apr 16, 2009 at 2:02 PM



I wrote the following code to create a table,


      Table grid = window.Get<Table>(“grid”);

      int count = grid.Rows.Count;


But when I checked the Count, it is coming correctly when I’m debugging line-by-line (Debug Selection in VSTS).


But wrong value is returned during Run Selection. ie either the value is increased / decreased by value 1.


When I analyzed, found that in the following code 2 element returned with same name “row 1”


        static TableRowFactory()


            rowPredicate =

                delegate(AutomationElement element)


                    return element.Current.Name.ToLower().Contains("row ".ToLower());




Any idea why this happens ?


Thanks & Regards,