Spy overrides existing objects in my repository instead of creating new ones

Hello! I’ve started on a new project and hoping for some help.

When i’m using Spy, i’m trying to capture all the buttons/objects within my web-based application, the problem is that many buttons have exactly the same class name. When I click on a NEW button, it seems to override the previous button that had the same class name (it’s basically just 6 vertical buttons in a left-hand menu) but updates all the attributes it had captured.

I’ve tried re-ordering all the xpath priorities, but same issue happens. Any one have any ideas what to try?

1 Like

Hi,

Absolutely exact same class name is really not a good case. Can you please try to add some other unique attributes like id, title, … or relative locators? Or else, can you try Recorder?

You will have to manually rename the elements so that you will know which one is which. Obviously, if your elements have the same name, the “next” one will overwrite the “previous” one, so get in there and make sure that doesn’t happen. Yes, it is time consuming, but, obviously, necessary.
I rename my elements similar to the nearest label if that helps: tag_section_nearestLabel

Thanks - I can definitely rename them and create them manually. The only issue is that once I go to create something using the recorder, I can’t then point it to the objects i’ve manually created (I have to save it, then go in, update it and start editing again) - not sure if this is something i’m doing wrong, but it would be great to have this as a feature in the future to be able to change the object in the web-recorder view as you go!

You can rename objects manually in the Web Spy by highlighting the name, if it is not already, within the Web Spy and then just change it. It is just a pain to do it over and over again with every object, but for me, it was necessary as I didn’t know which objects I had by the naming convention that KS used. With my naming convention, I still sometimes get confused on crowded pages, but then I go back and add more context to the name. It’s all about ME (and all others that follow in my position) knowing what objects are in the OR.

Edit: Saying this, I never used the Web Recorder after day one. The Spy can be useful even now, especially on our application that does not allow the right click to review the HTML.