How to get latest index of tabpage or ignore it

Best practices, code snippets for common functionality, examples, and guidelines.
oli3
Posts: 2
Joined: Thu Feb 25, 2016 12:43 pm

How to get latest index of tabpage or ignore it

Post by oli3 » Thu Feb 25, 2016 12:54 pm

Hello all

I'm trying to figure out how to not have to use the code "tabpage[@index='1']" for an element in my repository.

Is there a way to instead of having to use index=1 to use the latest index of the tabpages? Or is there a way to entirely wildcard that piece of code?

I've tried with "?" but that didn't work. I also tried with entirely removing that piece of code and leaving just "//" but also that didn't work during playback.

Code: Select all

container[2]//tabpage[@index='1']/element/container/container/container[1]//container[@automationid='LayoutRoot']/?/?/tabpage[@automationid='General']/container[1]/.......
I'm using Ranorex 5.4.5

Thanks

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

Re: How to get latest index of tabpage or ignore it

Post by odklizec » Fri Feb 26, 2016 9:06 am

Hi,

You can use function last()='True' in your xpath, like this:

Code: Select all

container[2]//tabpage[last()='True']/element/container/container/container[1]//container[@automationid='LayoutRoot']/?/?/tabpage[@automationid='General']/container[1]/.......
For more details about available xpath functions, check this user guide page:
http://www.ranorex.com/support/user-gui ... xpath.html

Hope this helps?
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

oli3
Posts: 2
Joined: Thu Feb 25, 2016 12:43 pm

Re: How to get latest index of tabpage or ignore it

Post by oli3 » Mon Feb 29, 2016 10:17 am

Thanks!