How can I handle the 'no such element: Unable to locate element'

When I have tried handling this error by many types of exceptions, such as the following, but it does not work. I have also tried handling failures (Optional, CONTINUE_ON_FAILURE) when used the visible method, so how can I handle it so that the code will continue without stopping?

Exceptions types


Use WebUI.waitForElementVisible(object, FailuerHandling.CONTINUE_ON_FAILURE) instead of verifyElementVisible. When the element has been found still invisible ater the specified timeout period, waitForElementVisible will NOT throw any StepFailedExcetpion. It will just log a message and return false.

On the other hand, verifyElementVisible() will DO throw a StepFailedException when the element has been found still invisible after the specified timeout period even if you specified FailureHandling.OPTIONAL. — You may think this behavior is wrong. But actually the keyword is implemented is as such.

Hey kazurayam ,

unfortunately , the same issue has appeared

I wanna search for reorder button inside the order line if it exists return true otherwise false ,so could you help me in that , because I have tried many solutions ,but the same issue appears

The message says “no such element”.
Then your CSS Selector must be wrong.
Please check if the selector is correct against the HTML source code of your target web page.

I have two order line one of them has a reorder button

the first one katalon recognizes it without any problem ,but the second one I have tried to use waitForElementVisible() for it to continue and return false if it does not exist , but the same mentioned issue appears

You need to check your CSS Selector against the HTML source code of your target Web Page. You haven’t showed us the HTML source. Therefore we, guys in this forum, can not see anything about your issue.