无法使用直到 WebDriverWait 的方法

Unable to use until method of WebDriverWait

我收到以下错误:

The method until(Function<? super WebDriver,V>) in the type FluentWait<WebDriver> is not applicable for the arguments (ExpectedCondition<Boolean>)

我的代码是这样的:

try {
            WebDriverWait wait = new WebDriverWait(getDriver(), 60);
            wait.until(
                    ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("div[class='ui-block']")));
        } catch (Exception e) {
            e.printStackTrace();
        }

我的 pom.xml 依赖项如下所示:

       <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.141.59</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>3.141.59</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
            <version>3.141.59</version>
        </dependency>

        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>4.2.2</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.48</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.0.0</version>
        </dependency>

我试图查找此错误并了解它是由于番石榴依赖性问题,我将其设为最新的 25-jre 和 21。但没有帮助。有人可以提出解决方案吗?

这是兼容性问题。解决可以使用Guava 21版+selenium 3.2.0版+JDK8.

更多详情请查看下方link:

https://softwaretestingboard.com/q2a/1907/function-webdriver-fluentwait-webdriver-applicable-arguments#axzz68BFzmEjv

希望对你有所帮助