.//?[@innertext='xxxx'] is always found

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
TimoL
Posts: 46
Joined: Thu Sep 13, 2018 3:08 pm

.//?[@innertext='xxxx'] is always found

Post by TimoL » Wed May 12, 2021 1:12 pm

If I use question mark, which should mean which ever tag, and some property, like innertext with some rubbish which does not exist in the AUT, both Ranorex and Spy claims the element is found.

If I use what ever tag instead of question mark, the element is not found (which is correct). Why the question mark works here incorrectly?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7469
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: .//?[@innertext='xxxx'] is always found

Post by odklizec » Wed May 12, 2021 2:20 pm

Hi,

Question mark does not mean “whichever” but “optional”! For “any” tag, use asterisk, like //*[@innertext=‘xxxx’]
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

TimoL
Posts: 46
Joined: Thu Sep 13, 2018 3:08 pm

Re: .//?[@innertext='xxxx'] is always found

Post by TimoL » Tue May 18, 2021 11:40 am

Thanks Odklizec! How simple mistake...

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7469
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: .//?[@innertext='xxxx'] is always found

Post by odklizec » Tue May 18, 2021 1:22 pm

Hi,

You are welcome. Don't worry about this. This could happen to anyone ;) I just debugged one thing for half an hour, only to find how stupid mistake I did :D
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration