Showing results for 
Search instead for 
Did you mean: 

How to get the Cell Object which I Clicked using function ClickCell in grid view

Occasional Contributor

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.


Community Hero

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.


Occasional Contributor

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.

Tags (1)
New Here?
Join us and watch the welcome video:
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Get properties of a web page element

See replies!

Compare images using the Region Checkpoint

See replies!

Compare HTML table with Excel file and correct data in Excel file


How to execute remote test and obtain results via Test Runner REST API

Top Kudoed Authors