@Test public void testAbcd() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.linkText("Sign In")).click(); driver.findElement(By.linkText("Sign In")).getText(); driver.findElement(By.xpath("//input[@name='loginName']")).clear(); driver.findElement(By.xpath("//input[@name='loginName']")).sendKeys("*****@*****.**"); driver.findElement(By.xpath("//input[@name='password']")).clear(); driver.findElement(By.xpath("//input[@name='password']")).sendKeys("demo123"); driver.findElement(By.xpath("//input[@type='image']")).click(); driver.findElement(By.linkText("Money")).click(); driver.findElement(By.linkText("Portfolio")).click(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); WebElement table = driver.findElement(By.id("table-holding-data")); if (table.isDisplayed()) { List<WebElement> rows = table.findElements(By.tagName("tr")); System.out.println("Row Count - " + rows.size()); Iterator<WebElement> i = rows.iterator(); System.out.println("Table has following content"); while (i.hasNext()) { WebElement row = i.next(); List<WebElement> columns = row.findElements(By.tagName("td")); Iterator<WebElement> j = columns.iterator(); while (j.hasNext()) { WebElement column = j.next(); System.out.print(column.getText()); System.out.print(" | "); } System.out.println("--------------------"); } System.out.println("Table content is printed"); } else { System.out.println("Table not found"); } }