1

我有不同的类来实现 ExpectedCondition;其中之一,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 回答