Hello,
I`ve been reading the docs up and down regarding the following problem, to no avail:
With
Selenium 3.141.59 it's possible to do the following:
Wait<WebDriver> wait = new FluentWait<>(driver).withTimeout(Duration.ofSeconds(3))
.pollingEvery(Duration.ofSeconds(1)).ignoring(NoSuchElementException.class);
wait.until(ExpectedConditions.presenceOfElementLocated(By.id("someID"));(NOTE that it doesn't matter whether I use FluentWait or WebDriverWait)
However, since the upgrade to
Selenium4 I get an
error for aforementioned wait.until:
The method until(Function<? super WebDriver,T>) in the type Wait<WebDriver> is not applicable for the arguments (ExpectedCondition<WebElement>)After some digging in docs and older tutorials I found out that originally there were supposed to be
TWO methods of
wait.until...one of them accepting a
Function<? super T, V> as parameter, the other accepting a
Predicate (the latter one of which is used in the code example above) (refer to e.g. here
https://www.toolsqa.com/selenium-webdriver/advance-webdriver-waits/).
According to the API docs, with Selenium4 there is only the first method provided/implemented (
https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/support/ui/Wait.html), BUT the official Selenium4 docs use the identical code that I'm using (the method getting a Predicate as parameter) (see
https://www.selenium.dev/documentation/webdriver/waits/).
Does anyone know how I can fix this and if it's possibly a bug or w/e that the 2nd method (
Predicate) doesn't exist anymore?
How can I change given code example to match the parameter requirements for the first method (
Function)? (Sorry I'm kinda new to this)
Thanks in advance!