Introduction
Let's ensure we understand the foundational concepts before delving further into the subjects. Here is a brief introduction if you are unfamiliar with Katalon Studio.

Katalon Studio is a tool that is developed by KM technology. It will also help you automate Web Based Applications, Mobile Applications, and API Testing. It increases the speed of delivery and time to market. Our organization has become better.
This product's recording feature is helpful for our testing needs. User-friendliness and AI smart healing capabilities are two of Its most valuable features.
This article explains how to check element status in conditional statements with katalon studio.
Without further ado, let's get started.
How to check element status in a conditional statement with katalon studio ?
Before taking further actions on an element during Web UI functional testing, you may want to ensure it is clickable, present, or visible. VerifyElementClickable is the function used in such a situation, and it has the following specifications:

💁 To learn how to use each statement, please see the following table:
Statement |
Description |
|---|---|
If |
An input value for this statement must be a boolean condition. As soon as the criteria are met, Katalon Studio will carry out all the stages. |
Else If |
Using Else If after If, You can construct a set of circumstances under which the actions contained in the first satisfied condition will be carried out. |
Else |
The If - Else If - Else pattern is concluded with this sentence. If none of the circumstances listed above are met, the procedures contained in this statement will be carried out. |
The following code block shows how to check the element status in a conditional statement. You can assume that the WebUI.verifyElementClickable function will return true if the element can be clicked and false otherwise.
if (WebUI.verifyElementClickable(findTestObject('Test Objects/Pages/Login Page/elContinue - Wrong'))) {
WebUI.click(findTestObject('Test Objects/Pages/Login Page/elContinue - Wrong'))
} else {
WebUI.click(findTestObject('Test Objects/Pages/Login Page/elContinue'))
}
However, in actual use, the function does not return false if the element is not located after the timeout. It returns the following exception instead:
Stack trace: com.kms.katalon.core.exception.StepFailedException:
Unable to verify object 'Object Repository/Test Objects/Pages/Login Page/elContinue - Wrong' to be clickable (Root cause: Web element with id: 'Object Repository/Test Objects/Pages/Login Page/elContinue - Wrong' located by 'By.xpath: //button[.='Continue - Wrong']' not found)
Given that the function has been utilised by the intended syntax and goal described in the API description, you could find it puzzling. This is why: There are two overloaded functions in Katalon Studio with the name verifyElementClickable.
💡 Function 1 with default FailureHandling.
💡 Function 2 with custom FailureHandling.
While the second function lets you specify the argument, the first function provides a default FailureHandling parameter. This will determine how the function behaves in a few certain circumstances.
You must use the second function with the FailureHandling.OPTIONAL option if you anticipate that the function will return false if the element is not found. The script that follows will meet your needs:
if (WebUI.verifyElementClickable(findTestObject('Test Objects/Pages/Login Page/elContinue - Wrong'), FailureHandling.OPTIONAL)) {
WebUI.click(findTestObject('Test Objects/Pages/Login Page/elContinue - Wrong'))
} else {
WebUI.click(findTestObject('Test Objects/Pages/Login Page/elContinue'))
}




