How to get the Cell Object which I Clicked using function ClickCell in grid view
I am facing an issue that I cannot access all rows in the Grid view because the row index property "WPFControlOrdinalNo" is returning random numbers if grid is having rows more than 5 rows with vertical scrollbar.
I can click the cells of specified column through the built in function like this GridObject["ClickCell"](i,DataColRef);
i want to get the cell object i just clicked through function so that i can access the row through parent property and manipulate it as per my test.
Would be a great help if someone can assist me.
Below function will Return i which will give you the cell no and will click on the cell as well with the below parameters:
Grid - Grid Object
Column - Column name to be clicked
Value - Which value to be clicked in Column
function ClickGrid(Grid,Column,Value)
{
var RowIndex;
function FindRow(Grid, Column, Value, ViewId)
{
if (typeof(ViewId) == "undefined")
ViewId = 0;
for (var i=0; i<Grid.wRowCount(ViewId); i++)
if (Grid.wValue(i, Column, ViewId) == Value)
return i;
return -1;
}
RowIndex = FindRow(Grid,Column,Value);
if (RowIndex != -1)
{
Grid.ClickCell(RowIndex, Column);
Log.Message("Row index: " + RowIndex + " Column Name: " + Value);
}
else
Log.Error("Row was not found");
}