Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .//*[@id='contentText']/table/tbody/tr[2]/td/table/tbody/tr/td[1]/table/tbody/tr[9]/td/table/tbody/tr/td[1]/strong[2]
- .//*[@id='contentText']/table/tbody/tr[2]/td/table/tbody/tr/td[1]/table/tbody/tr[10]/td/table/tbody/tr/td[1]/strong[2]
- // Get the content or container
- WebElement content = driver.findElement(By.id("contentText"));
- //Get the table of users
- WebElement tblUsers = content.findElement(By.xpath(".//table/tbody/tr[2]/td/table/tbody/tr/td[1]/table"));
- // Get the rows which change always as and when users are added
- WebElement allUsers = tblUsers.findElements(By.xpath(".//tbody/tr"));
- // Loop through each row of users table
- for(WebElement user : allUsers) {
- // Get the username
- WebElement username = user.findElement(By.xpath(".//td/table/tbody/tr/td[1]/strong[2]"));
- System.out.println("Username: " + username.getText());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement