Error "Unable to click on object" - ecommerce website

I am using Katalon Studio Record for ecommerce website so sometimes product in cross selling changes the position. In this case when I recorded test case and I try play it, I have an error “Unable to click on object” becuase it is not the same object. What should I o in this situation?

2 Likes

please let us know if you are using the Katalon recorder or the Record web option in Katalon studio.

Please Note:
as per your question, the application seems to be changing dynamically.
in this case, recording will not help you. you have to start designing a robust and stable test script to handle the same using the katalon studio.

1 Like

If you are only using the Recorder, then you may not be waiting long enough for your objects to appear on the page. If this is the case, then you need to add “wait” statements to your test script. The Recorder will not do that, so you have to do it personally.
As an example, if you are moving from one page to another, then you should add:
WebUI.waitForPageLoad(10)

When you land on a new page, then you might have as the first statement,
WebUI.waitForElementVisible(findTestObject(...), 10)

If you have a drop-down that changes based upon another drop-down, like country and then state/province, then you might use:
WebUI.waitForElementClickable(findTestObject(...), 10)

Hopefully, you get the drift.
Edit: this assumes you are using the Web Recorder of Katalon Studio. Katalon Recorder would have other statements to do any wait time.

2 Likes

If as @bharathi.a suggests and you have a dynamic app, then you will have to NOT use the Recorder and spend time learning how to write pathways personally.
Even if the objects on the page move around and they are static references, the pathway to them based on their id or name will still locate them. If this is the situation, then your pathways are flawed and you again should review them personally. A carpenter still has to know how to use his hammer and saws and which one to use at the correct time.

2 Likes

Hi @patrycja.piatek-bole , As Mike said you may have to do some work to get your recorded case(s) working… This might be a good starting point for you: How to manually create XPath locators based on HTML tags using Chrome

This page lists some tools that may help you to determine the required locators for your testing.

You can also check this link out: XPath in Selenium: How to Find & Write? (Text, Contains, AND)

Good luck.

2 Likes