Exception Handling Statements
Note:
Once a test step is added as any of the control statements, it is not allowed to change into another keyword.
In Manual view
In Script view
The Script view of test cases allows you to programmatically define and handle exceptions using Groovy or Java language. For more details about exception handling in Groovy, refer to this Groovy documentation: Try - Catch - Finally.
For example:
try {
WebUI.openBrowser('')
WebUI.navigateToUrl('katalon.com')
if (WebUI.getText(findTestObject('Object Repository/txt_singin')).length() < 0) {
throw new com.kms.katalon.core.exception.StepFailedException('Value required')
}
}
catch (StepErrorException e) {
this.println(e)
}
catch (Exception e) {
this.println("General issue occurs.")
}
finally {
this.println("Navigate to a page.")
}