Wednesday, December 11, 2013

Confirm text is displayed in webpage

public boolean isTextPresent(String text) {
    List<WebElement> foundElements = driver.findElements(By.xpath 
("//*[contains(text(), '" + text + "')]"));
    return foundElements.size() > 0;
}

No comments:

Post a Comment