TestComplete - RowCount showing wrong count for grid and display some empty cells.
Attached here is the table shown in the screenshot Grid.png
Attached the TestComplete Object browser.png. I am seeing that RowCount is 4, why it shows 4 it should be 3. Also I am seeing it captured some cells which do not have any elements.
I already talked to developer there are no hidden rows
HTML tables like that aren't always a "grid" object per say. So, there are 4 rows in the HTML table but one of those rows may contain something entirely different. It would be interesting to see what TestComplete sees in those cells in row 1... could be that they are place holders, filters taht are non-visible, etc. Not that they are "hidden" deliberately by the developer, but the component that they are using for that table may have some other <tr> tags in them that generate a row.
Basically, keep in mind that "RowCount" is a constructed value based upon the content of the table, not necessarily based upon what is visible on screen.
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Try recording a short test and click around on the two rows and some of the other objects that are in your screenshot. Then you'll see what TestComplete thinks their names are and that may give you some more clues.
[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.
Are you using a third party addin to generate the grid ? If so, the layout of the underlying table can change based on the settings you put in the markup. e.g. I work with DevX, which has a setting for AdaptivityMode. Set it as hidden HideDataCells and DevX puts an empty column at the end. Set it to HideDataCellsWindowLimit and DevX puts a visible=false cell with colspan the entire table in the top. Set it to show filter and another row is inserted at the top. TC can only return you what the actual HTML markup that these tools generate is created and in this case it's 4 rows. You will either need to remember and adjust how many lines are before the first visible row and add that to your row accordingly or use some FindChild/FindChildEx etc to find the rowindex of one of the cells you are looking for and work with that rather than the actual row number. Related discussions:
Standard syntax disclaimers apply
why dont you print contentText or innerText of each cell of 4th row to see what is there. I suspect there is a overlap, thats the reason it may be showing 4 as count including header.
Just something like:
for k in range(0,round(tblrowCnt)):
wndChild2 = tblchkpostsearch.Cell(k+1,0).Panel(1);