2013-07-30 33 views
0

我有這樣的硒測試,用Java編寫的,對於頁面上的有源元件測試比作宣佈WebElement在頁面上。我看了所有在互聯網上的答案,但都沒有成功。這是我有什麼,但因爲它不比較活躍的元素和我想要的WebElement失敗。有源元件比不上通緝WebElement

public class OWBLocatorInquiryPage extends BasePage { 
    @FindBy(id = "orderNo") 
    private WebElement focusOnOrderNumberWE; 

    private String locatorInquiryPageString = "locatorInquiry.owb"; 

    public OWBLocatorInquiryPage(WebDriver driver) { 
    super(driver); 
    } 

    public boolean isFocusedOnOrderNumber() { 
    WebElement focusElement = driver.switchTo().activeElement(); 
    return (focusElement == focusOnOrderNumberWE); 
    } 
} 

回答