xpath td class contains text code example
Example 1: xpath select td class contains text
WebElement content = driver.findElement(By.id("contentText"));
WebElement tblUsers = content.findElement(By.xpath(".//table/tbody/tr[2]/td/table/tbody/tr/td[1]/table"));
WebElement allUsers = tblUsers.findElements(By.xpath(".//tbody/tr"));
for(WebElement user : allUsers) {
WebElement username = user.findElement(By.xpath(".//td/table/tbody/tr/td[1]/strong[2]"));
System.out.println("Username: " + username.getText());
}
Example 2: xpath select td class contains text
xpath=