2014-03-13 45 views

回答

0

要知道是否單擊按鈕的唯一方法是實際驗證您單擊按鈕時得到的響應。爲什麼你想知道它是否被點擊..你想驗證響應..只要你能找到該元素,那麼你可以點擊它..如果你不能找到或點擊它,那麼將發生異常..一旦你點擊..你驗證迴應。

0
public static boolean isClickable(WebElement webe){ 
try 
{ 
WebDriverWait wait = new WebDriverWait(yourWebDriver, 5); 
wait.until(ExpectedConditions.elementToBeClickable(webe)); 
    return true; 
} 
catch (Exception e) 
{ 
return false; 
} 

boolean bst = className.isClickable("your element"); 
相關問題