I am new to Katalon and I am doing a trial of the product.
Here is my flow:
- I click a button, which then starts a countdown of 60s
- After 60s a message pops up on the page. The html definition is as follows:
Now, when I try to detect that message using the groovy statement:
def isVisible = WebUI.waitForElementVisible(locator, 62)
where locator is defined to be something like:
def pullDeviceConfigLocator = findTestObject(‘Object Repository/path/to/message object’)
One of two things will happen:
a) the waitForElementVisible will timeout and isVisible will return false
or
b) an exception is thrown:
Caused by: org.openqa.selenium.StaleElementReferenceException: stale element reference: stale element not found
I think what is happening is that this UI element is so short lived that either the method waitForElementVisible simply misses that UI element or it does find it but because it is so short-lived, that when it tries to reference / verfies its existence, the exception is thrown.
I have tried using waitForElementPresent, but that returns true right away because that element is present, but just hidden.
I have also tried using waitForElementClickable, but it behaved about the same as the waitForElementVisible (in that it timed out).
Any ideas on how to solve this issue?
No, I do not believe it is a Katalon specific issue. Perhaps something to do with Selenium & related to performance ( ?? )
Overall, my fallback plan is to simply insert:
CucumberKW.delay(60)
It is not an ideal solution, but workable (in that I am not really interested in the transient message, but I am using it as an evergreen solution such that if the timer ever changed from 60 seconds to some other value, then the waiting for the message to appear is always there, at least I am assuming).
I am just wondering if others have encountered similar situations and are there some best practices / guidelines on handling this type of situation.
Thanks!