I need to validate if page refreshed successfully or not where page is refreshing every 5 seconds
Asked
Active
Viewed 597 times
0
-
Have a look at [this](https://stackoverflow.com/questions/18637123/selenium-ide-how-to-verify-assert-page-refresh). It could be your answer – user1207289 Feb 01 '19 at 14:17
1 Answers
0
Pick an element on the page and wait for it to go stale using ExpectedConditions.stalenessOf(e)
.
For example,
WebElement html = driver.findElement(By.tagName("html"));
new WebDriverWait(driver, 20).until(ExpectedConditions.stalenessOf(html));
// if you get here the page refreshed
If you need to know how fast the page refreshed, you will want to add a stopwatch and start it before and check the timing after. If you want to repeatedly check, you will want to put the code above in a loop, etc.

JeffC
- 22,180
- 5
- 32
- 55