Too much time to verify if an element is visible

Hi,
I would like to verify if an element is visible into a web page. If this element is present do something, else do something else.
I tried different ways but all take too much time :

  • continue on failure
  • try catch.
    Have you a solution without to pass by an error ?

Would be nice to see what you have tried, i dont really understand what your saying in regards to it takes to much time but if you follow something like this it should be fine

  If ( WebUI.verifyElementPresent(findTestObject('Page_CuraHomepage/btn_MakeAppointment'), 20))
    {
         doWhateverYouWannaDo();
    }
    Else
    {
         KeywordUtil.markFailed("element not present");
    }

First example :

try {
WebUI.verifyElementVisible(findTestObject(‘Page1/texte1’))
WebUI.click(findTestObject(‘Page/btnValidate’))
}
catch (Exception e) {
WebUI.click(findTestObject(‘Page/btnSave’))
}

If the element is not visible, It take lot of time before to catch the exception and execute the second block.

Second exemple :

if ( WebUI.verifyElementVisible(findTestObject(‘Page1/texte1’),FailureHandling.OPTIONAL))
{
WebUI.click(findTestObject(‘Page/btnValidate’))
}
else {
WebUI.click(findTestObject(‘Page/btnSave’))
}

If the element is not visible, it take lot of time to execute the else block.

But your way to use a time could help me, thanks !

Ahhh, so that will be your project settings, there is a new addition to v7 called smart wait which you most likely have enabled, which increases the waiting times. If you disable this you should see a decrease. Its also whatever the number of seconds you set to wait for before each method times out. I cant remember the exact location and dont have my laptop with katalon on me to check. If you cant find it im sure @Russ_Thomas knows what im talking about.

1 Like

Nice ! It’s exactly that :smile:
Thank you guys :sunny:

1 Like