Objects is no longer clickable

hello dears, @kazurayam @ThanhTo @duyluong @Andrej_Podhajsky
please I have a problem that happens to me every time, sometimes I can click on my elements, sometimes I can’t click on.
So each time I have to inspect the item again, copy xpath then paste into my object after that the click can work.
how I can stabilize my objects, because they change suddenly, and I do double work so it turns so heavy for me :upside_down_face: :upside_down_face: it makes me tired.

I need your help dears, i’m blocked not, i must to inspect again item oups!!!

It could be that after an event, the pathways to your elements change, such as after a Save. You can try to create your objects in code rather than in the Object Repository, checking for any pathway changes. (Be cautious of Copy and Paste.)
Saying that, part of the challenge in testing is that sometimes web pages evolve with changes in laws, processes, products, whatever. Really, we are doing Regression Testing of how the page used to perform when you created the script. If your pages are changing, well…
Also, do you sometimes rewrite the xpath from what the Web Spy has so that the path starts closer to the specific element or do you just go with the Spy’s choice?

Something like:

This example is from another Q&A. The below xpath that the Spy had is really unmanageable.

Especially when it could be simplified to:

usually that happens if

  1. absolute path is used
  2. id of elements are generated by some kind of UI/BE framework
    how to solve - there is no universal solution, you need to learn what to use based on experience and after analyzing html of page

here are my rules when i’m working on objects:

  1. make it short (use relative xpath)
  2. make sure that with xpath you hit only 1 element (check what you generated)
  3. if in big trouble ask UI devs for arbitrary ID (e.g. @qa-id in elements) usually they cooperate since it’s for their own good
  4. try to make objects by hand without recorder, it will be slow on beginning but after some time you will not come back to recorder
  5. choose either xpath or css and dive deep in choosen form of addressing

if you need more help or concrete help share html of page you testing so we can help analyze

1 Like

We need to see the HTML for the element in question. @ferrariklersone we’ve been down this path before. Try and save everyone some time and share all the info in your OP! :smiley:

1 Like

the elements change when a new deployment of the application is made.
i noticed this twice, and it forces me to capture new xpath for all forms and fields again.

Yes you are right, I am not familiar with parsing html to create objects by hand like you said. Very often, I use the web spy mode from katalon or sometimes I inspect the elements to have either the css or xpath.

heavy now :upside_down_face:

there are a lot of pages containing multiple fields.
I can’t have fun showing all the html, it’s scary. :upside_down_face:

Then we can’t help you :frowning:

I don’t know what could I do, my objects change anytime when new deployment is done.
is this case all tests failed. :frowning:

Do your web designers use static attributes, id, or name? If they do (and do not keep changing the id or name), then you can use those attributes so you would not have to keep changing the xpath. If they don’t then you should ask them if they would. If they complain, then have a group discussion with Management about the importance of your testing (or not).

If they use id or name:
id("theObjectId") or //*[@id="theObjectId"]


we are not able to help you (except what was already said) without knowledge of html you have problem with…

It is a Frequently Asked Question in this forum. If you make a search in this Katalon Forum with key “dynamic id”, you will find a lot of previous posts where people struggled with the same problem as yours.

You should read them through for ideas what you could do. For example, I provided a solution to @Hamza_Abbas1 Nov 2018 as this:

I do not know if it helps you or not.

Please be advised that Katalon’s Spy & Recorder tools can not solve the “dynamic ID” problem auto-magically. Now you should STOP using these tools. The “dynamic ID” problem requires testers to be skilled enough. You should study the basic technologies: HTML + CSS + JS + Groovy + XPath. You should train up yourself so that you can write Test Case scripts and Test Object’s locators manually without the tools. With sufficient skill obtained you would find a way.

Thank you @kazurayam

thank you i will check this solution.

such as this text field, now unable to fill that after deployment of the App.

The id changed, test fails now.
@Brandon_Hein thank you !

What is the xpath that you currently have for Bank Reference?

xpath i used : //div[@id=‘bank_reference’]/div/input

i’ve created it manually.