本文介绍了错误:类型为ExpectedConditions的方法elementToBeClickable(By)不适用于参数(WebElement)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Selenium的新手,正在尝试逐步学习一些代码.它在Utils.java文件中使用以下显式等待功能.

I am novice to Selenium and trying to walk through some code.It uses Explicit Wait as below functions in Utils.java file.

public static void waitForElement(WebElement element){

     WebDriverWait wait = new WebDriverWait(driver, 10);
     wait.until(ExpectedConditions.elementToBeClickable(element));

        }

我编译时给出错误:-

推荐答案

从错误消息中很明显,该方法 ExpectedConditions.elementToBeClickable()只能接受类型By.您不能直接将网络元素作为参数传递给方法.

It is very clear from the error message that the method ExpectedConditions.elementToBeClickable() can accept only the type By. you cannot directly pass a web element as a parameter to the method.

看看 https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html 了解预期条件及其参数的列表.

have a look at https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html to know the list of expectedconditions and their parameters.

这篇关于错误:类型为ExpectedConditions的方法elementToBeClickable(By)不适用于参数(WebElement)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 00:11