Each time the web page has changes I want to get the text elements of web page. So for having the text elements, here is my method:
public void getContentPage(WebDriver driver) {
WebDriverWait wait = new WebDriverWait(driver, 15);
WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.tagName("body")));
System.out.println(element.getText());
}
What I need is a kind of listener using Selenium to call the above method each time there are changes in HTML body content:
public void listen (WebDriver driver) {
// some kind of listner that waits for any changes to happen in HTML
if (changed) getContentPage(driver);
else keeplistning()
}