2014-03-13 116 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"); 
相关问题