Not able to Recoginze ContextMenu

Class library usage, coding and language questions.
Posts: 4
Joined: Tue Dec 01, 2009 6:30 am

Not able to Recoginze ContextMenu

Post by pjaddu » Tue Dec 01, 2009 7:15 am

Hello Team ,

I have requirement like there will be button when i clicked that then a context menu will be displayed and i will select an item from that.
This action i have done through the Recording Procedure and Ranorex done that as well.
It stored all the things in the Repository. i.e There is Folder "ContextMenuMenuPopUp" and with in that "MenuItemMenuItem1".

Now the Problem i am facing is that I tried to Automate This Procedure using c# Script. when i Tried to TypeCast the "ContextMenuMenuPopUp" as ContextMenu . It is Throwing an error as
"Cannot Convert ContextMenuPopupFolder" to "Ranorexr.ContextMenu" via a reference conversion,boxing conversion,unboxingconversion,wrappingconversion, or null type conversion (CS0039).

Kindly Request you to give the solution for this.


User avatar
Support Team
Site Admin
Site Admin
Posts: 12169
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Not able to Recoginze ContextMenu

Post by Support Team » Tue Dec 01, 2009 7:00 pm

For folders you need to use the folder's Self property to get the element corresponding to that folder:
ContextMenu menu = repo.ContextMenuMenuPopUp.Self;
See following topic in the Ranorex User Guide for more information: ... html#c1802

Ranorex Support Team