[WebUI] Verify Element Clickable


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/webui-verify-element-clickable.html

The line in example is wrong.

WebUI.verifyElementClickable(findTestObject('Page_CuraHomepage/btn_MakeAppointment'), 20)

verifyElementClickable method doesn’t have a parameter of time out.

Can this method be applied to links?

@denis1

I find “WebUI.verifyElementClickable()” keyword has very limited usability. I wonder what you expect for this keyword to perform.


You can read the source code of WebUI.verifyElementClickable keyword here:

Line#78

                    WebElement foundElement = WebUIAbstractKeyword.findWebElement(to, RunConfiguration.getTimeOut())
                    if (foundElement.isEnabled()) {

All it does is to check if the call to org.openqa.selenium.WebElement.isEnabled() returns true or false.

WebElement.isEnabled() — how does it work? You can read the W3C Specification here:

https://www.w3.org/TR/webdriver1/#is-element-enabled

I understand that WebElement.isEnable() returns false only when

  • the element is a Form element, like <input type="text">
  • and the element has the disabled attribute ON, like <input type="text" id="fname" name="fname" value="John" disabled>

Otherwise, in all other cases, WebElement.isEnable() returns true, therefore WebUI.verifyElementClickable() returns true.

If you apply WebUI.verifyElementClickable() to a HTML tag <a href="">, I believe the call will always return true. All it means is that you can click the <a> element (regardless what happens then). It is not a useful verification at all, I think.

Thanks. It’s a shame that this method can’t help me with the links. I solved my question with a code like this:

WebUI.callTestCase(findTestCase('Stage Env/Stage Log In'), [:], FailureHandling.STOP_ON_FAILURE)

url = WebUI.getAttribute(findTestObject('Property list/Table/BBL link'), 'href')

println(url)

WebUI.verifyMatch(url.substring(0, 4), 'http', false)

WebUI.closeBrowser()

The following post might interest you.