Environment:Ranorex2.1.2.6480,Win7,AdobeReader
Step: 1. Open Aodbe
2. Select and click Help menu
3. Select About and click
My job will across national languages ,therefore ,i can't use text to identify a menuitem,suck like 'About'. On Adobe Reader menu ,these objects has no controlid or controlname, I want to click the menuitem by its childindex. childindex of Help is 6, childindex of About is 2. When i use childindex , script will fail unless i use AccessibleName or text.
On diffrient languages, shortcut key may be diffrient,like Ctrl+O on US, Ctrol+?? on Br/GR/IT
Can't i use childindex to click a menu?
Can't i use ChildIndex to identify a object
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Can't i use ChildIndex to identify a object
Hi marcushe,
set the index within the brackets of the menu item in RxPath like:
/form[@title='Untitled - Notepad']/menubar[@accessiblename='Application']/menuitem[2]
Regards,
Christian
Support Team
set the index within the brackets of the menu item in RxPath like:
/form[@title='Untitled - Notepad']/menubar[@accessiblename='Application']/menuitem[2]
Regards,
Christian
Support Team
Re: Can't i use ChildIndex to identify a object
Thanks guys, a little question:
When i use RanorexSpy to capture the menuitem , it is based on 0.Such as File,View,Window, File's childindex is 0,View's is 1. Once i want to click the first one in script,i must use in Rxpath ....Application/menuitem[1] , instead of ....Application/menuitem[0].
When i use RanorexSpy to capture the menuitem , it is based on 0.Such as File,View,Window, File's childindex is 0,View's is 1. Once i want to click the first one in script,i must use in Rxpath ....Application/menuitem[1] , instead of ....Application/menuitem[0].
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Can't i use ChildIndex to identify a object
The RxPath is based on the XML Path Language (XPath). Indexing in XPath begins from 1 instead of 0 e.g. in the CSharp language. So 'element.Children[]' indexing is programming language dependent.
Additional info:
The index in RxPath references to the corresponding element type e.g. menuitem[2] is the second menuitem in the actual tree level. Element.ChildIndex instead counts from zero and does not care about the type of element, it just returns the index of the corresponding child in its parent.
Regards,
Christian
Support Team
Additional info:
The index in RxPath references to the corresponding element type e.g. menuitem[2] is the second menuitem in the actual tree level. Element.ChildIndex instead counts from zero and does not care about the type of element, it just returns the index of the corresponding child in its parent.
Regards,
Christian
Support Team