18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

How to loop through table rows using Java?

ganeshprganeshpr Members
edited November -1 in Sahi - Open Source
OS: Windows 7
Browser: Firefox 3.6.23
Sahi build: 2011-07-19

I am trying to loop through a table with indefinite number of rows. Since there is no identifier for rows, only way is to loop through and compare values in timestamp column to figure out the actual record.

Is there a way to loop through table rows in Java?

Regards,
Ganesh

Comments

  • Provide more detail on this, what kind of table your are trying to work on?
    if possible provide me link of the page where you have that table & also provide your objective with the table.
    -Ashish
  • // get number of rows in java
    int rows = Integer.parseInt(browser.fetch("_sahi._table('tableId').rows.length"));

    //get values from each column and rows
    for (int i = 1; i < rows; i++) {
    for (int j = 1; j < cols; j++) {
    String txt = browser.cell(browser.table(value), i,j).getText();
    }
    }

    Let me know if it works fine for you
Sign In or Register to comment.