aldebaran
15 years agoOccasional Contributor
Unable to select gridview-cells
Hi all,
My TC-Project needs to select certain rows/cells of a .Net gridview control. Recording KeywordTests saves clicks within the grid with coordinates. The problem with those coordinates occur if those tests are run on a different OS or a different style setting on same OS, meaning one cannot rely upon the coordinates to select certain grid-cells or controls, e.g. checkboxes in grid.
I´m unable to select rows/cells with the provided gridview-methods of the object explorer.
Say I have a grid with 3 rows and 4 columns. Upon setting the grid to editable, the focus is automatically set to the first cell in the last row, often being a new row in grid.
What do I have to do if I need to select the second cell in the first row? How can I use the CallObjectMethods of a gridview to do the trick? Everything I tried didn´t work.
Alternativly using a script-method has the same not satisfying result,
Sub SelectCellForEntries(ColNum, RowNum, nameOfForm)
Select case nameOfForm
case "frmXYZ"
Aliases.CEBELClient.frmCEBELMDIMain.MdiClient.frmXYZ.grd1(ColNum,
RowNum).Click()
case Else
Log.Error "Argument not in case list"
end Select
End Sub
Can someone provide an example?
greets
Carsten
My TC-Project needs to select certain rows/cells of a .Net gridview control. Recording KeywordTests saves clicks within the grid with coordinates. The problem with those coordinates occur if those tests are run on a different OS or a different style setting on same OS, meaning one cannot rely upon the coordinates to select certain grid-cells or controls, e.g. checkboxes in grid.
I´m unable to select rows/cells with the provided gridview-methods of the object explorer.
Say I have a grid with 3 rows and 4 columns. Upon setting the grid to editable, the focus is automatically set to the first cell in the last row, often being a new row in grid.
What do I have to do if I need to select the second cell in the first row? How can I use the CallObjectMethods of a gridview to do the trick? Everything I tried didn´t work.
Alternativly using a script-method has the same not satisfying result,
Sub SelectCellForEntries(ColNum, RowNum, nameOfForm)
Select case nameOfForm
case "frmXYZ"
Aliases.CEBELClient.frmCEBELMDIMain.MdiClient.frmXYZ.grd1(ColNum,
RowNum).Click()
case Else
Log.Error "Argument not in case list"
end Select
End Sub
Can someone provide an example?
greets
Carsten