If I have a table which is designed in this manner: If you have an ID for the table its really good to catch the table else you will have to do alot of manipulation with the tables you find... // Here I try to identify the table using its ID. WebElement table = webdriver.findElement(By.id("tableID")); // Here I try to identify the table using a simple xpath WebElement table = webdriver.findElement(By.xpath("/html/body/table/tbody")); // Get all the rows of the table List rows = table.findElements(By.tagName("tr")); Iterator i = rows.iterator(); System.out.println("-----------------------------------------------"); // Iterate over the rows of the table while(i.hasNext()) { WebElement row = i.next(); // Find all the columns of the row List columns = row.findElements(By.tagName("td")); Iterator j = columns.iterator(); System.out.print(" | "); // Iterate over the columns of the ...
In this fast world of IT...Learning is quintessential :) Here is my way of learning!!!