1// Get the content or container
2WebElement content = driver.findElement(By.id("contentText"));
3
4//Get the table of users
5WebElement tblUsers = content.findElement(By.xpath(".//table/tbody/tr[2]/td/table/tbody/tr/td[1]/table"));
6
7// Get the rows which change always as and when users are added
8WebElement allUsers = tblUsers.findElements(By.xpath(".//tbody/tr"));
9
10// Loop through each row of users table
11for(WebElement user : allUsers) {
12
13 // Get the username
14 WebElement username = user.findElement(By.xpath(".//td/table/tbody/tr/td[1]/strong[2]"));
15 System.out.println("Username: " + username.getText());
16}
17