错误:类型为ExpectedConditions的方法elementToBeClickable(By)不适用于参数(WebElement) [英] Error:The method elementToBeClickable(By) in the type ExpectedConditions is not applicable for the arguments (WebElement)

查看:434
本文介绍了错误:类型为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)不适用于参数(WebElement)

The method elementToBeClickable(By) in the type ExpectedConditions is not applicable for the arguments (WebElement)

推荐答案

从错误消息中很明显,该方法 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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆