I noticed that there is inconsistency between documentation and actual product’s behavior. Documentation says that TestObject and timeout parameters are required (+ FailureHandling as optional param).
But actually, there are only 2 method overloads in Katalon - 1/ TestObject and 2/ TestObject + FailureHandling.
If this is correct, please update your doc. And one more question - is it possible to change this default timeout which is 30sec? I mean, only for this method, not a global timeout. Thanks!
static boolean verifyElementVisible(TestObject to, FailureHandling flowControl)
Verify if given web element is visible
static boolean verifyElementVisible(TestObject to)
Verify if given web element is visible
I think it would be nice to have option:
static boolean verifyElementVisible(TestObject to, timeOut int, FailureHandling flowControl)
Hello,
I have the same issue for Katalon v5.2.
Do you plan to fix this issue? Timeout could be really useful in some cases.
I think this issue also exist on other keywords like VerifyElementExist
When object ‘Object Repository/LMO_LoginPg/ErrorMessage1’ is not visible, the code does not go to else part. It shows error message.
Error message:-
Test1 FAILED because (of) Failed to check for element 'Object Repository/LMO_LoginPg/errorMsg1 ’ visible (Root cause: Element 'Object Repository/LMO_LoginPg/errorMsg1 ’ not found)
Can someone tell me whether I have missed anything here and reason for getting this message?
The verifyElementVisible function takes a 3rd optional parameter which tells the test how to behave when the element is not found:
FailureHandling.STOP_ON_FAILURE = Default behavior. Exits/fails the test as soon as the element is not found
FailureHandling.CONTINUE_ON_FAILURE = reports that an error occurred during the run but doesn’t exit; continues running the “else” clause
FailureHandling.OPTIONAL = no error reported; continues running the “else” clause
So, if you want to make use of your “else” condition, you can write:
// Set how long to wait to interact with/verify an element on the screen.
// Setting this to 0 seems to fall back to the project default, which could be 30 sec.
// If you don't want to wait that long, set to an integer > 0.
int timeout = 1
// This doesn't actually get the object on the screen, just the definition from the object repository
TestObject errorMsg1 = findTestObject('Object Repository/LMO_LoginPg/ErrorMessage1')
// Check if the error message element is visible on the screen, but don't fail the test if it's not.
boolean errorMsgFound = Mobile.verifyElementVisible(errorMsg1, timeout, FailureHandling.OPTIONAL)
if (errorMsgFound == true)
{
Mobile.tap(errorMsg1, timeout)
}
else
{
CustomKeywords.'writeDataToExcel.WriteDataToExcelSheet.WriteDatatoDataFile'(username, 3)
Mobile.takeScreenshot('C:\\Alok\\KatalonStudio_LMO\\LMO\\Test Cases\\Screenshots\\Login_LoginSuccssful.png')
}