Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用硒';功能的预期状态。然后呢?_Java_Selenium - Fatal编程技术网

Java 如何使用硒';功能的预期状态。然后呢?

Java 如何使用硒';功能的预期状态。然后呢?,java,selenium,Java,Selenium,我似乎不知道如何将Selenium 3.7.1的ExpectedConditions与函数连成一个链来使用。这个问题的最小减少是以下编译失败,我希望你不要考虑主题,因为它非常棘手,没有例子或文档给我任何线索: WebElement webElement0 = null; Function<WebDriver, WebElement> function0 = ExpectedConditions.visibilityOf(webElement0); Function<WebDri

我似乎不知道如何将Selenium 3.7.1的
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>