2016-09-28 11 views
0

私はSeleniumの初心者で、いくつかのコードを実行しようとしています。 Utils.javaファイルで以下の関数を明示的に使用します。 エラー:ExpectedConditions型のメソッドelementToBeClickable(By)が引数(WebElement)に適用されません

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)

+0

「** ExpectedConditions **」のelementToBeClickable(** By **)メソッドを強調しましょう。 JavaSocに行き、 'ExpectedConditions.elementToBeClickable'が期待するパラメータの種類を調べます。言い換えれば、Read That F ... ine Manual。 –

+0

この例外は[[ExpectedConditions.elementToBeClickable() '](https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html# elementToBeClickable-org.openqa.selenium.WebElement-)も 'WebElement'を受け取ります?? –

+0

あなたはどのバージョンのセレンを使用していますか? –

答えて

1

それは方法 ExpectedConditions.elementToBeClickable()のみタイプByを受け入れることができ、エラーメッセージから非常に明確です。メソッドへのパラメータとしてWeb要素を直接渡すことはできません。

https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.htmlを見ると、予想される条件とそのパラメータのリストを知ることができます。

+0

いいえ、['ExpectedConditions.elementToBeClickable()']](https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html#elementToBeClickable-org.openqa .selenium.WebElement-)も 'WebElement'を受け取ります –

0

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

あなたはExpectedConditions.elementToBeClickable、パラメータとしてのみByオブジェクトを受け入れるold version of selenium <= 2.37.0を使用しているように見えます。

しかし、selenium version >= 2.38.0ExpectedConditions.elementToBeClickableByWebElementオブジェクトをパラメータとして受け入れます。

この例外を取り除くには、upgrade your selenium version to latest stable version 2.53.0または>= 2.38.0をお勧めします。

関連する問題