I am struggling to uniquely identify items in a context menu.
I have the technique down to delay tracking, and can effectively look at all of the elements in my context menu. However, every item in the menu is simply 'MenuItem', and I cannot seem to find any uniquely identifiable attribute. Currently, Ranorex just uses 'contextmenu/menuitem[1]'
Here is a picture of the context menu:
As you can see, each item in the context menu has a different text.
However, if you look at the elements in Spy, there are no references to the text in the context menu. See attached snapshot.
Is there something I am missing, or is there no way to uniquely identify the elements in this custom context menu, other than image-based?
Identifying elements in a context menu
Identifying elements in a context menu
You do not have the required permissions to view the files attached to this post.
Re: Identifying elements in a context menu
Greeting,
Looking at the provided snapshot it appears you are not getting very much to work with (likely due to poor/missing accessibility on the element). Due to this, you have three options:
Use the RXPath index -
/contextmenu[@processname='CMW']/contextmenu/menuitem[1]
/menuitem[2]
/menuitem[3]
Use the ChildIndex attribute -
/contextmenu[@processname='CMW']/contextmenu/menuitem[@ChildIndex='1']
[@ChildIndex='2']
[@ChildIndex='3']
Alternatively, you can always use image-based.
Looking at the provided snapshot it appears you are not getting very much to work with (likely due to poor/missing accessibility on the element). Due to this, you have three options:
Use the RXPath index -
/contextmenu[@processname='CMW']/contextmenu/menuitem[1]
/menuitem[2]
/menuitem[3]
Use the ChildIndex attribute -
/contextmenu[@processname='CMW']/contextmenu/menuitem[@ChildIndex='1']
[@ChildIndex='2']
[@ChildIndex='3']
Alternatively, you can always use image-based.
Re: Identifying elements in a context menu
Hi,
I would also suggest to try GDI capture approach (described in user guide), which often helps with extracting RAW texts from apps, with poorly or not implemented accessibility. It’s not perfect, but definitely better than unrealiable (from long-term perspective) image-based automation.
I would also suggest to try GDI capture approach (described in user guide), which often helps with extracting RAW texts from apps, with poorly or not implemented accessibility. It’s not perfect, but definitely better than unrealiable (from long-term perspective) image-based automation.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Identifying elements in a context menu
I did look at GDI, but for some reason, it is not an option on this particular context menu.
After looking again, I was able to manually add the process name to the GDI capture list, and it does capture. GDI is not my favorite, but it's better than nothing
After looking again, I was able to manually add the process name to the GDI capture list, and it does capture. GDI is not my favorite, but it's better than nothing