[英]How to verify whether a Button is clicked or not with Selenium WebDriver using Java
I want to verify whether a button is clicked or not with Selenium WebDriver using Java. 我想使用Java使用Selenium WebDriver验证是否单击了按钮。 How can I verify this?
我该如何验证?
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");
The only way to know if a button is clicked.. Is to actually validate the response you get when you click the button. 知道是否单击了按钮的唯一方法是真正验证单击按钮时得到的响应。 And why would you want to know if it is clicked.. You want to validate the response.. As long as you can find that element, then you can click it.. If you cant find or click it, then an exception will occur.. Once you click.. you validate the response.
以及为什么要知道是否单击了它。您想验证响应。只要找到该元素,您就可以单击它。如果找不到或单击它,则会发生异常..一旦单击..您验证响应。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.