OR condition in XPath

Best practices, code snippets for common functionality, examples, and guidelines.
Posts: 18
Joined: Mon Dec 09, 2019 1:37 pm

OR condition in XPath

Post by prasoon.jmit » Thu Dec 19, 2019 12:01 pm


Can I use OR condition in XPAth?

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

Re: OR condition in XPath

Post by odklizec » Thu Dec 19, 2019 12:14 pm


Yes, you can use conditions in Ranorex xpaths. For example like this:

Code: Select all

element//container/button[@accessiblename='Close' or @accessiblename='' and @accessiblerole='PushButton' and @visible='true']
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