猿问

无法解析方法“in(Java.util.concurrent.TimeUnit)”

获取以下错误消息


Cannot resolve method 'in(Java.util.concurrent.TimeUnit)'

使用下面的代码片段,在java类中说A


getImplicitWaitTimeout().in(TimeUnit.SECONDS)

A类使用的Java类方法


private Duration waitForElementTimeout;



public Duration getImplicitWaitTimeout() {

        if (this.waitForElementTimeout == null) {

            int configuredWaitForTimeoutInMilliseconds = ThucydidesSystemProperty.WEBDRIVER_TIMEOUTS_IMPLICITLYWAIT.integerFrom(this.environmentVariables, (int)DefaultTimeouts.DEFAULT_IMPLICIT_WAIT_TIMEOUT.toMillis());

            this.waitForElementTimeout = Duration.ofMillis((long)configuredWaitForTimeoutInMilliseconds);

        }


        return this.waitForElementTimeout;

    }

这与Java 8有关吗?


森栏
浏览 516回答 1
1回答

温温酱

如果您想要持续时间的秒数,只需get它们。无需转换。getImplicitWaitTimeout().getSeconds();
随时随地看视频慕课网APP

相关分类

Java
我要回答