Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. .//*[@id='contentText']/table/tbody/tr[2]/td/table/tbody/tr/td[1]/table/tbody/tr[9]/td/table/tbody/tr/td[1]/strong[2]
  2.  
  3. .//*[@id='contentText']/table/tbody/tr[2]/td/table/tbody/tr/td[1]/table/tbody/tr[10]/td/table/tbody/tr/td[1]/strong[2]
  4.  
  5. // Get the content or container
  6. WebElement content = driver.findElement(By.id("contentText"));
  7.  
  8. //Get the table of users
  9. WebElement tblUsers = content.findElement(By.xpath(".//table/tbody/tr[2]/td/table/tbody/tr/td[1]/table"));
  10.  
  11. // Get the rows which change always as and when users are added
  12. WebElement allUsers = tblUsers.findElements(By.xpath(".//tbody/tr"));
  13.  
  14. // Loop through each row of users table
  15. for(WebElement user : allUsers) {
  16.  
  17. // Get the username
  18. WebElement username = user.findElement(By.xpath(".//td/table/tbody/tr/td[1]/strong[2]"));
  19. System.out.println("Username: " + username.getText());
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement