gpt4 book ai didi

java - 错误:The method elementToBeClickable(By) in the type ExpectedConditions is not applicable for the arguments (WebElement)

转载 作者:行者123 更新时间:2023-12-01 09:27:17 24 4
gpt4 key购买 nike

我是 Selenium 的新手,正在尝试浏览一些代码。它使用显式等待,如下 Utils.java 文件中的函数。

public static void waitForElement(WebElement element){

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

}

当我编译时出现错误:-

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

最佳答案

从错误信息中可以很清楚地看出该方法 ExpectedConditions.elementToBeClickable() 只能接受类型 By。您不能直接将 Web 元素作为参数传递给该方法。

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

关于java - 错误:The method elementToBeClickable(By) in the type ExpectedConditions is not applicable for the arguments (WebElement),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39739025/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com