I have the below method in my code to check if a text was updated on the web page. As for the code, I will keep refreshing the web page until the text changes to "Hot" and call the same method again and again to check the XPath value.
public void waitTillStatuschange() {
if(!driver.findElement(By.Xpath(Status)).contains("Hot")) {
driver.refreshBrowser();
waitTillStatuschange();
}
}
I have sometimes seen the same piece of code executing for more than 3, or 4 hours as the text has not changed to "Hot".
So what might be the best option to forcefully end this method if the text did not change after refreshing for 4 times?