I have different versions of a software with a different menu.
Is it possible to make sure that I read the AutomationId directly without going through the path of the menu?
In fact, the menu changes:
in the first version is /treeitem[3]/treeitem[4]/element[@automationid='26226']
but in the other is /treeitem [3]/treeitem [2]/element[@automationid='26226']
I'd like to click to element[@automationid='26226'] but I do not want to change the code.
Thank you
Menu path change different software version
Re: Menu path change different software version
Try this:
"treeitem[3]/?/?/element[@automationid='26226']"
This will find the element as long as it's parent, grandparent or great-grandparent is a treeitem.
The ? means that that location in the XPath is optional.
"treeitem[3]/?/?/element[@automationid='26226']"
This will find the element as long as it's parent, grandparent or great-grandparent is a treeitem.
The ? means that that location in the XPath is optional.
Shortcuts usually aren't...
Re: Menu path change different software version
Hi dariof,
If you're sure that middle treeitem element always exists but only index changes and no other nodes may be placed between the existing ones in different versions, I'd offer to leave it in as
/treeitem[3]/treeitem/element[@automationid='26226']
In this case the difference may be several milliseconds but in large test suites this really saves time and leads to improving your coding skills because it's more precise.
From my previous Rx experience, the more detailed path you provide, the faster Rx will find the element for this path. Just don't forget to make sure about how much dynamic the nodes are and if they should be "/node[index]/" or "/node/" or "/?/".
If you're sure that middle treeitem element always exists but only index changes and no other nodes may be placed between the existing ones in different versions, I'd offer to leave it in as
/treeitem[3]/treeitem/element[@automationid='26226']
In this case the difference may be several milliseconds but in large test suites this really saves time and leads to improving your coding skills because it's more precise.
From my previous Rx experience, the more detailed path you provide, the faster Rx will find the element for this path. Just don't forget to make sure about how much dynamic the nodes are and if they should be "/node[index]/" or "/node/" or "/?/".
Re: Menu path change different software version
Thanks for the reply.
Last question, Can I set the default recording without indexes?
I' d like to have path without indexes.
Now the default recording is this:
/treeitem[3]/treeitem[4]/element[@automationid='26226']
I'd like to have default recording like this:
/treeitem/treeitem/element[@automationid='26226']
Is it possible? Thanks!
Last question, Can I set the default recording without indexes?
I' d like to have path without indexes.
Now the default recording is this:
/treeitem[3]/treeitem[4]/element[@automationid='26226']
I'd like to have default recording like this:
/treeitem/treeitem/element[@automationid='26226']
Is it possible? Thanks!
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: Menu path change different software version
Hello dariof,
If I got your question correctly, you don't want to have indices in your path.
In general, the 'Text', 'AccessibleName' or 'AccessibleRole' attribute is used to uniquely identify a TreeItem.
Do you have such attributes for your TreeItem in your application that uniquely identifies it?
Could you please post a Ranorex Snapshot of your application?
Please take a look at our User Guide for more information on how to create snapshot files
Thanks in advance.
Regards,
Markus (T)
If I got your question correctly, you don't want to have indices in your path.
In general, the 'Text', 'AccessibleName' or 'AccessibleRole' attribute is used to uniquely identify a TreeItem.
Do you have such attributes for your TreeItem in your application that uniquely identifies it?
Could you please post a Ranorex Snapshot of your application?
Please take a look at our User Guide for more information on how to create snapshot files
Thanks in advance.
Regards,
Markus (T)
Re: Menu path change different software version
Snapshot in attach.
Thanks
Thanks
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: Menu path change different software version
Unfortunately, there is currently no way to disable the index alone. What you can do, is modifing the RanoreXPath generation parameters (supported since Ranorex 4.1.0) to not include tree items at all. I'm not sure that is always OK for your application
You can do that by opening the Ranorex Settings, selecting the "Advanced" tab, and clicking on "Edit Path Build Options..." (also see corresponding section in the user guide).
Now, in order to not include menu items in the path at all, scroll down the list until you reach "treeitem" and give it a value of "0". From now on, the automatically generated RanoreXPaths will not contain tree items any more.
If you are not satisfied with the outcome, you can always reset the parameters using the "Restore Defaults" button in the RanoreXPath Build Options dialog.
Regards,
Alex
Ranorex Team

You can do that by opening the Ranorex Settings, selecting the "Advanced" tab, and clicking on "Edit Path Build Options..." (also see corresponding section in the user guide).
Now, in order to not include menu items in the path at all, scroll down the list until you reach "treeitem" and give it a value of "0". From now on, the automatically generated RanoreXPaths will not contain tree items any more.
If you are not satisfied with the outcome, you can always reset the parameters using the "Restore Defaults" button in the RanoreXPath Build Options dialog.
Regards,
Alex
Ranorex Team