Why does Ranorex not like two conditions in an xPath

Ask general questions here.
mariya.syera
Posts: 9
Joined: Wed Nov 08, 2017 10:59 pm

Why does Ranorex not like two conditions in an xPath

Post by mariya.syera » Sat Jul 07, 2018 12:18 am

I had scripts running with no issues in ranorex versions before 8.1 where the xPath has two conditions as in, an ID and visible=true (or any other). After 8.1 was released it does not find the xPath and scripts fail.

Example of an xPath: .//input[@id='ctl00_phFolderContent_BillingProviderName' and @value='Test1']

Is this intended?

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

Re: Why does Ranorex not like two conditions in an xPath

Post by odklizec » Sat Jul 07, 2018 6:34 am

Hi,

I’m pretty sure that xpath conditions work OK. My tests are full of them and I would quickly realise that there is something wrong with them. Are you sure that both conditions apply for the element in question (at a time of accessing the element)? Could you please post exact error message you got and a Ranorex snapshot of the problematic element? Thanks.
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

sstowe
Posts: 62
Joined: Thu May 31, 2018 2:26 pm

Re: Why does Ranorex not like two conditions in an xPath

Post by sstowe » Mon Jul 16, 2018 7:08 pm

Is it appropriate to add a question on here? Can you point me to a sample of how to do a conditional xpath? I have not yet found that in the documentation. Thank you.

dpFourOFour
Certified Professional
Certified Professional
Posts: 39
Joined: Mon Dec 12, 2016 9:24 am

Re: Why does Ranorex not like two conditions in an xPath

Post by dpFourOFour » Wed Jul 18, 2018 1:15 pm

Hi sstowe,

This blog post might be helpful for you.
You can combin attributes by 'and' or 'or' to make your path more reliable.

Hope that helps,

DP
Please always include the following information to your posts
  • Ranorex Version
  • OS Version

sstowe
Posts: 62
Joined: Thu May 31, 2018 2:26 pm

Re: Why does Ranorex not like two conditions in an xPath

Post by sstowe » Wed Jul 18, 2018 1:32 pm

Ayuh! Thanks!