Java 如何使用硒';功能的预期状态。然后呢?
我似乎不知道如何将Selenium 3.7.1的Java 如何使用硒';功能的预期状态。然后呢?,java,selenium,Java,Selenium,我似乎不知道如何将Selenium 3.7.1的ExpectedConditions与函数连成一个链来使用。这个问题的最小减少是以下编译失败,我希望你不要考虑主题,因为它非常棘手,没有例子或文档给我任何线索: WebElement webElement0 = null; Function<WebDriver, WebElement> function0 = ExpectedConditions.visibilityOf(webElement0); Function<WebDri
ExpectedCondition
s与函数连成一个链来使用。这个问题的最小减少是以下编译失败,我希望你不要考虑主题,因为它非常棘手,没有例子或文档给我任何线索:
WebElement webElement0 = null;
Function<WebDriver, WebElement> function0 = ExpectedConditions.visibilityOf(webElement0);
Function<WebDriver, WebElement> function1 = ExpectedConditions.visibilityOf(webElement0).andThen(ExpectedConditions.elementToBeClickable(webElement0));
为什么函数
传递给,然后
想要在同时删除了一个试图从理论上解决问题的答案之后,我必须强调,每个人都可以在提供的MCVE中验证解决方案。这就是为什么它存在并由网站强制执行的原因。
richtercloud/selenium/and/then/NewMain.java:[25,97] method andThen in interface java.util.function.Function<T,R> cannot be applied to given types;
required: java.util.function.Function<? super org.openqa.selenium.WebElement,? extends V>
found: org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement>
reason: cannot infer type-variable(s) V
(argument mismatch; org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement> cannot be converted to java.util.function.Function<? super org.openqa.selenium.WebElement,? extends V>)
richtercloud/selenium/and/then/NewMain.java:[20,157] incompatible types: org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement> cannot be converted to java.util.function.Function<? super org.openqa.selenium.WebElement,? extends org.openqa.selenium.WebElement>