get the nth attribute

Ask general questions here.
rsudhak
Posts: 72
Joined: Fri Jan 04, 2019 1:38 pm

get the nth attribute

Post by rsudhak » Tue Feb 12, 2019 9:05 am

hi ,

I have a list of menu, say L1,L2,L3...Ln , similarly I have a list of sub -menu say K2,L2,M2... . sub menu is a context menu pop up box. I have 3 questions here
1. how do I get the element xpath easily, please note that I am new to Ranorex, I want something similar to Actions class in selenium, where I can click on the menu and then move to the sub menu. (spy doesnt help here :( and cntrl plus windows crashes spy)
2.In the scenario you see that L2 is in the menu as well as submenu, When I run the test on its own it passes, but when run as a suite it fails and always click the L2 from the the menu instead of the sub menu. whats the best way to differentiate the two elements.
3. Also , is there a way to select the nth attribute eg . I can select the menu item with //menuitem[@name='L2'], I want to select the submenu by giving the nth attribute eg something like //menuitem[@name='L2][2], so that it clicks on 2nd element with the attribute i.e the submenu

Thanks

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

Re: get the nth attribute

Post by odklizec » Tue Feb 12, 2019 9:14 am

Hi,

There is no point in creating duplicated posts. Please check my answer in your original post:
get-the-nth-attribute-t13445.html#p52822
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