Forum Discussion

Luukdb's avatar
Luukdb
Contributor
3 years ago

xPath won't recognize

Hello,

I am trying to create a generic mapped object using xPath. But for some reason TestComplete cannot find the element.

I am trying to get the selected selector working. As it is now it doesn't seem to recognize the selector and it's using OR so it has to go through all the selectors, am I right?

When deselecting, TestComplete does recognize the selector. But I want to create a general selector. And for some reason start-with doesn't work, because multiple results are found.

I also checked the TestComplete documents to see if there is anything about this but I only get general xPath information.

Is there anyone who can help me with this? 

 

Kind regards,

Luuk

8 Replies

  • ApplePen's avatar
    ApplePen
    Community Leader

    When there are multiple xpaths(1,2,3,4,5) in the same object of the namemapping. Like your capture shown.

    I think the check rule like below.

    TestComplete will recognize the object with the order of the selected xpaths.

    If 1 failed it will check 2. If 2 failed it will check 3....

     

    If you want to recognize the object correctly.

    1.Make sure the xpath is correct first.

    2.Make sure the object display when you operate it by xpath.(You can add delay time in the previous step)

     

    To the xpath:

    You can try to replace start-with with contains.

     

    I hope it can help.

     

     

     

  • brumazz's avatar
    brumazz
    SmartBear Alumni (Retired)

    Have you attempted using a wildcard in the name mapping?  Or edit the order of selectors

     
    • Luukdb's avatar
      Luukdb
      Contributor

      Hello,

      Yes I tried to change the order and what happens is, the one selected is recognized, but others aren't. It seems that for some reason only the first or second selected selector are being used.

       

      As for the wildcard, the * won't work using xPath, as far as I tried.