Архив метки: C#

CodedUI test: How to get the cell by value from table/grid

I was stuck in grids in my CodedUI test. The grid could change depends on test data, so it is impossible to define solid SearchProperties for cell as them are changing.

public void SelectCell(string type)
WinTable table = this.UILocalaccountsWindow.UIGridLocalAccountsWindow.UIDataGridViewTable;
WinCell myCell = table.FindFirstCellWithValue(type);

So I define a table in my method and then use method FindFirstCellWithValue with argument string.

It was so easy I even do not believe in that, but it is working.