2011-09-14 7 views

答えて

0

私の解決策は、@ FindByを使用しないことです。あなたのページのオブジェクトで

By someElementLocator = By.cssSelector(".locator"); 

    public void waitForElementPresent(final By locator, int timeout) { 
    ExpectedCondition e = new ExpectedCondition<Boolean>() { 
     public Boolean apply(WebDriver driver) { 

      return driver.findElements(locator).size() > 0; 
     } 
    }; 

    WebDriverWait wait = new WebDriverWait(driver, timeout); 
    wait.until(e); 

} 

    public WebElement getSomeElement() { 
    waitForElementPresent(someElementLocator); 
    return driver.findElement(locator); 
    } 

多分それは建築の問題です。 @FindByサポートが待っていることを確認するリソースは見つからないようですが、その使用法はテスト設計/アーキテクチャに依存している可能性があります。

関連する問題