Table of contents
1.
Introduction
2.
How to check element status in a conditional statement with katalon studio ?
3.
Frequently Asked Questions
3.1.
Does Katalon use Web Driver?
3.2.
How to change the font size in Katalon Studio?
3.3.
What is Katalon Studio?
4.
Conclusion
Last Updated: Mar 27, 2024

How to check element status in conditional statement with katalon studio ?

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

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. 

How to check element status in conditional statement 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:

How to check element status in a conditional statement with katalon studio ?

Image source
 

💁 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'))
}

Frequently Asked Questions

Does Katalon use Web Driver?

The Selenium engine is used by Katalon Studio to automate web application testing. This indicates that Katalon makes use of the Selenium Web Driver technology while shielding consumers from the challenges of using Web Driver. 

How to change the font size in Katalon Studio?

For Katalon Studio: Access Colors and Fonts by going to Window> Preferences > General > Appearance. Choose Dialog Font, then change the font size. Activation dialogue first appears after the app has launched. To activate your licence, log into your account.

What is Katalon Studio?

It is a tool that is developed by KM technology. It will help you to automate Web Based Applications, Mobile Applications, and API Testing as well. 

Conclusion

Congratulations on finishing the blog! We have discussed how to check element status in conditional statements with katalon studio, in which we talk about if, else if, and else conditions with an example.

We hope this blog has helped you enhance your knowledge of How to check element status in conditional statements with katalon studio. If you'd like to learn more, Check out the following links:

🔥 Sample API Test Projects in Katalon

🔥 Library Management in Katalon Studio

🔥Ready API

 

Please refer to our guided pathways on Code studio to learn more about DSACompetitive ProgrammingJavaScriptSystem Design, etc. Enroll in our courses, and use the accessible sample exams and questions as a guide. For placement preparations, look at the interview experiences and interview package.

Please upvote 🏆 our blogs if you find them helpful and informative!

Happy coding🤗

Live masterclass