I am trying to write a Selenium object Builder for a Swagger page, in groovy. For the purposes of this discussion, my problem code can be reduced down to the following:
After the most excellent research / suggestion by @Louis, I ended up using:
def wait = new FluentWait(By.className("resource")).
withTimeout(10, TimeUnit.SECONDS).
ignoring(NoSuchElementException)
wait.until(new Function() {
WebElement res
Boolean apply(By by) {
def oldRes = res
res = driver.findElement(by)
return res == oldRes
}
})
If anyone is interested, the entire Builder can be found on SourceForge (still under construction at the time of this writing).