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.
Solved! Go to Solution.
What sort of random? If it's 20 rows, are you still getting rows numbered 1-20 or 0-19 and they just aren't in the expected order? Or are you getting strange row index values that have nothing to do with the number of rows?
If you have 0-19 or similar, you could still loop through the rows to process your test. It would be jumping around on the rows but they would all eventually get processed.
Other options would be
1) See if there's another index value hidden down in the properties somewhere.
2) Use something other than the index value to loop through. If it's always known data, then you could save a table with the text values or whatever you are using and just use that to match each row and loop.
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
Like if grid have 10 rows with the scrollbar. property gives index 1 to 5 till row 5 but when i scroll to see rest of the rows it start giving the index of other rows as random number (e.g. 4, 2,1,8) everytime i scroll and access the row with object spy it gives me different number. so i can not access the row with the descriptive programming.
I want to access the cell which is currently clicked in the grid. in that way probably i can get access to all rows.
What would be the correct way to do it, what do you think @anupamchampati @tristaanogre @Vallalarasu_P ?
Community and Education Specialist
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 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)
RowIndex = FindRow(Grid,Column,Value);
if (RowIndex != -1)
Log.Message("Row index: " + RowIndex + " Column Name: " + Value);
Log.Error("Row was not found");