We need to create a test where you click to generate a report, a notification bar with a button appears on the page while the report is generating, and then disappears again once the once the data is ready. I am able to record this with no problems; the bar appears on the screen long enough for me to click the button on it, and Katalon recorder correctly creates an element for this button. But when I run the recorded test, Katalon is unable to find the button before it disappears again. I have been able to verify in dev tools that the xpath in the button test object works to find the button, and it is on screen for several seconds. But Katalon consistently returns WebElementNotFoundException. Anyone know what is happening and/or how we can get around this problem?
Edited to add that the notification bar contains a constantly updating timer, and the report section contains the word ‘Loading…’ plus a spinner while the bar is on the screen; could Katalon be waiting because of one of these? It really doesn’t seem to be finding any element on the page until these disappear.
Instead of being too slow to find the element, perhaps KS is too fast and it is trying to detect the element when it has not shown up yet. Can you add a waitFor of delay to try this out, like below?
WebUI.waitForElementVisible(findTestObject('...'), 10)
Try disabling Smart Wait. I might be causing the problem you’re seeing.
Thanks, this was the cause. I realised yesterday after posting and was going to write a reply saying so.
Do you know if it is possible to turn smart wait off just for this one test? I’m afraid turning it off will cause other tests in the suite to time out.
1 Like
No.
Smart Wait just confuses you. You should never use it.
Isn’t this supposed to be one of the benefits of Katalon? If we turn it off, we’ll have to go back to adding manual waits, which requires more time and expertise from the QAs writing the tests.
Do you really think it is?
I would rather regard Smart Wait a mistake. It may look user-friendly but it spoils the oppotunities for users to learn how Selenium WebDriver works.
Up to you.
I prefer adding manual waits at every point appropriate. I would rather like to be resposponsible for every detail of my code.
You can, within the test case code:
That’s from the link I gave you.
Thank you. I hadn’t opened it because I assumed it was the same document I already looked at, which only mentioned the global settings.
in object repository you will find more than 1 element locators try with any of them