Retrieving Grid count for particular rows using Coded ui

190 views Asked by At

I am possessing a grid.I want to get the Grid Count for particular rows excluding the rows of a particular value.how can I get the grid count for such condition using Coded UI ?

1

There are 1 answers

0
Ryan Cox On BEST ANSWER

I'd create a list, then loop through a collection of your rows and add the rows that match your needs to the list. Then, just count the objects in the list.

UITestControlCollection myRows = rowDefinition.FindMatchingControls();
list<string> matchingRows = new list<string>();

foreach (UITestControl control in myRows)
{
    if (!control.GetProperty("InnerText").ToString().Contains("myValue"))
        matchingRows.Add(control.GetProperty("ID").ToString());
}

int theRowsIWant = matchingRows.Count;