Clicking on two identical buttons in the same screen

Actually, it didn’t work fine. Your algorithm didn’t cover the problem domain.

That’s because your choice of algorithm is fixed, it can’t “dynamically adapt” to the change in your head, and the code (and browser) really don’t care where you store these things in Katalon.

That’s right, because it’s the same algorithm which you’ve already proved is faulty.

Yes, we do. You made a good job of showing us the results of your trials but you didn’t show us the definitions of your Test Objects. Do they use CSS? XPath? How do the buttons fit into the structure of the HTML document in the page?

If you read this post, you’ll get some good advice about how to report errors: