Coded UI - how to identify the grid row and columns inserted dynamically
In the control properties, new row has name equals to Volume Row 62 and Row Index equals to 61 - as recorded and add values in few columns.
When I insert a new row with external data and fill the respective columns, it tries to override the column data in the row which was used in the recording and not the one that is being inserted.
If i remove the 62 and 61 from the Row Properties and make that general, it goes to the first row in the grid and tries to edit.
What properties should be changed or searched for so that columns is populated correctly in the the new row (whose name and row index is not known).
any help is appreciated.
开发者_如何学GoThanks.
To solve this in our application we exported the UI map method and created a temp list using VAR I don't know if this will work for you or not but solved several of our issues around dynamic grid rows and columns:
public void DoubleClickLaunch_UOW() {
var temp = this.UIWindow.UIUnitGridTable.GetChildren().ToList();
temp.RemoveAt(0);
var rows = temp.Select(t => t.GetChildren().Select(s => s.GetValue()).ToList()).ToList();
var tractLetters = rows.Select(s => s[1]).ToList();
var index = tractLetters.IndexOf(DoubleClickLaunch_UOWParams.UITESTUNIT_TPText);
if (index >= 0)
{
var textbox = temp[index].GetChildren()[1].GetChildren()[0];
Mouse.DoubleClick(textbox);
}
else
{
Mouse.DoubleClick(this.UIWindow.UIUnitGridTable.UIItemRow.UIUnitNameCell.UITESTUNIT_TPText);
}
精彩评论