Issue with wait methods

‘Wait for Page Load’ and explicit wait methods does not work. To wait for specific seconds, have to use ‘delay’ method. Please suggest how to handle such issues in Katalon

1 Like

Please, follow this advice

I think I can help here in explaining (sorry that this isn’t BDD specific).

In my website testing, I log on as a user who may or may not have items in the shopping cart. If an overlay message indicates that there are items from a previous session, I want to discard them. If there’s no message, then I carry on. To tackle this, I used “Verify Element Visible” to wait for / see if the aforementioned message is visible, making it an optional step so it doesn’t fail the test if it times out. But I am very limited in defining the wait time. Since there’s no time parameter on the call, unlike “Verify Element Present”. The only wait for “Verify Element Visible” is defined by the default execution timeout for the whole project. Here is the test that I call from my main test to clear out the cart, if needed:

cartNotEmpty = WebUI.verifyElementVisible(findTestObject('Object Repository/MFE Testing Pages/Account Home/Cart Merge Modal/button_Discard'), FailureHandling.OPTIONAL)

if (cartNotEmpty) {'Object Repository/MFE Testing Pages/Account Home/Cart Merge Modal/button_Discard'))
} else {
	cartNotEmpty = WebUI.verifyElementVisible(findTestObject('MFE Testing Pages/Header/span_cartItemCount'), FailureHandling.OPTIONAL)
	if (cartNotEmpty) {'MFE Testing Pages/Header/span_cartItemCount'))'MFE Testing Pages/Cart/a_DeleteItem'))'MFE Testing Pages/Cart/button_confirmDelete'))

I should note that I check 2 ways for the cart to have items – one is if the overlay message is present, the other is if the cart icon has a little circle icon above it with the count of items in it. When there is none, the cart is empty. I have to check both because when the overlay is present, I can’t see the cart icon. It’s easiest to use the discard button on the overlay, but it only shows up under certain circumstances.

As a result of this check, if I can end up waiting 2 times the max project wait time to check for those 2 items to be present. Is there no better way of making the checks quicker? Shouldn’t there be an overloaded version of VerifyElementVisible that takes a timeout value?

Thanks in advance,