1

ExpectedCondition を実装するさまざまなクラスがあります。そのうちの 1 つである AttributeContainsCondition を以下に示します。私のテストでは、条件ドットのようなものを使用して、ExpectedCondition から利用可能なすべてのメソッドと、ExpectedCondition を実装する作成したすべてのクラスを確認しようとしています。

したがって、私のテストでは、ExpectedCondition からすべてのメソッドと、ExpectedCondition を実装する作成したすべてのクラスを取得するために何かを追加しようとしています。クラスを作成した場所をインポートしています。

public class AttributeContainsCondition implements ExpectedCondition<Boolean>{

    private final WebElement element;
    private final String attributeName, expectedValue;

    public AttributeContainsCondition(WebElement element, String attributeName, String expectedValue){
        this.element = element;
        this.attributeName = attributeName;
        this.expectedValue = expectedValue;
    }

    public Boolean apply(WebDriver input){
        return StringUtils.contains(element.getAttribute(attributeName), expectedValue);
    }
}

テストファイル: これは機能していません

import org.openqa.selenium.support.ui.ExpectedConditions;
public class VerifyInfoTest extends mainTest {
    ExpectedConditions condition = new ExpectedConditions<boolean>(); ????

したがって、condition.xxxx を使用すると、ExpectedConditions のメソッドと、それを実装するために作成したすべてのクラスが表示されます。

ありがとうございました :)

4

1 に答える 1

0

AttributeContainsCondition を使用したい場合は、wait.until

次の方法で使用できます。

boolean result = wait.until(new AttributeContainsCondition(
      yourWebElement,
      "yourAttributeName",
      "yourExpectedValue"));
于 2013-06-13T17:50:32.057 に答える