Identifying Row for dynamic grid/ Table

I have an application generates table/grid and loads dynamically every time and I need to get the count of the number of rows. But the table rows change everytime.

The underlying technology used is HandsonTable (JSpreadsheet) to generate the same.

Suppose I give the XPATH  – .//*[@id=’dgrid’]/div[4]/div/div/div/table/tbody/tr[15]

Though the grid has 50 rows the Xpath for the last row shows as mentioned in the XPath

Comments/Suggestions are welcome.

Have anyone come across automating JSpreadsheets or Applications developed in HandOnTable.

Thanks In Advance

SD Train Asked on June 2, 2016 in Selenium WebDriver.
Add Comment
2 Answer(s)

Hey SD, Thanks for asking a question that has good amount of information to work on. Coming to your question, there is a sample table from HandOnTable

Here if you try to get the xpath of last row, it does return 22th row and similary for al rows it returns the right XPath.

If your table loading dynamically? May be if you scroll down then only all the rows will appear?


Virender Singh Professor Answered on June 3, 2016.
Add Comment

Yes Virender the table in my application looks pretty similar. Yes table loads in DIV to get all the rows I scroll down using actions. But the Table row count and actual count varies.

I am unable to get the pattern.

For example, the dynamic grid has 129 rows of data. So the XPATH for the same would be as shown below:

  • xpath=(//input[@type=’checkbox’])[57]
  • //div[@id=’dgrid’]/div[4]/div/div/div/table/tbody/tr[28]/td/input
  • //div[4]/div/div/div/table/tbody/tr[28]/td/input

We can only come to conclusion on XPATH when there is a pattern or else for different rows of data XPATH would fail.


SD Train Answered on June 6, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.