Forum Discussion

klabbe's avatar
Occasional Contributor
2 years ago

Object in Name Mapping only using the first selector (Web application)

Hi,   For a few days, I have multiples issues with TestComplete that is using only the first selector of the object in the Name Mapping.   I have an object that has to 2 selectors. Sometimes, the...
  • chriscc's avatar
    2 years ago


    Hi Katherine,


    TestComplete will search for an object based on the properties you supply and return the first one that matches your criteria. If you don’t define the criteria narrow enough, then it might find a very similar object but not the one you desire or expect.


    In your case the application probably has both the AccountCash and AccountCreditCard listboxes created in memory. However, the AccountCash listbox, based on some condition, hasn’t been made visible and has a width of zero, top left and bottom right points both are at the same location (0,103).


    By narrowing your criteria (adding not(@style="display: none;")) you are searching for visible textboxes, so the AccountCash textbox, which is not visible and has zero width, is not found and TestCopmlete then moves to your second xpath definition.


    You can see in the image below if you search for a window that have a WindClass of XLMAIN, then TestComplete might find the Windows(“XLMAIN”, “”, 2) window and not Window(“XLMAIN”, “Book1 – Excel”, 1), which is the visible window.  



    I hope this helps.