I change from WebDriverWait to FluentWait because it was deprecated and now I'm getting an error

private val waitForElement = FluentWait(DriverFactory.driver).withTimeout(Duration.ofMinutes(1)).pollingEvery(Duration.ofSeconds(1))
@Step("Choose button")
    fun Wizard() {
        waitForElement.until(ExpectedConditions.elementToBeClickable(firstPage.wizardLocator))
        firstPage.wizardLocator?.click()
            ?: throw IllegalStateException("could not locate the wizard button")
    }

Getting this error:

Message: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element
1

There are 1 best solutions below

0
On

As per ExpectedConditions.elementToBeClickable()

An expectation for checking an element is visible and enabled such that you can click it.

You are supposed to use the above function when you're sure that the element exists at the page but you want to wait until it can be interacted with. You're getting the exception because the element is not present at the page at all.

So the options are in:

More information: How to use Selenium to test web applications using AJAX technology