Class MenuItem
- Namespace
- Ranorex
- Assembly
- Ranorex.Core.dll
Represents an entry in a menubar or context menu.
public class MenuItem : Adapter, IAdapter
- Inheritance
-
MenuItem
- Implements
- Inherited Members
Constructors
MenuItem()
Creates a new MenuItem adapter instance. This constructor is used internally by the Ranorex Core Framework for performance issues!
protected MenuItem()
MenuItem(Element)
Creates a new MenuItem adapter instance.
public MenuItem(Element element)
Parameters
elementElementThe element to create the adapter for.
Exceptions
- NullReferenceException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
Properties
Checked
True if the menu item is checked.
public virtual bool Checked { get; set; }
Property Value
Exceptions
- SetAttributeFailedException
Thrown if setting the attribute value failed.
Image
The image or icon of the menu item.
public virtual Image Image { get; }
Property Value
RequiredCapabilities
Capabilities required by the adapter implementation.
protected override string[] RequiredCapabilities { get; }
Property Value
- string[]
Text
The text of the menu item.
public virtual string Text { get; }
Property Value
Methods
FromElement(Element)
Converts an Element to an instance of this class.
public static MenuItem FromElement(Element element)
Parameters
elementElementThe element to convert.
Returns
- MenuItem
The MenuItem.
Exceptions
- ArgumentNullException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
FromPath(string)
Converts a string to an instance of this class by searching the root.
public static MenuItem FromPath(string path)
Parameters
pathstringThe search path.
Returns
- MenuItem
The MenuItem.
Remarks
The DefaultSearchTimeout is used to search for the specified path.
Exceptions
- ArgumentNullException
If
pathisnull.- RxPathException
If the specified
pathis not valid.- ElementNotFoundException
If no element is found.
- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
Select()
Selects the menu item.
public virtual void Select()
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
Operators
implicit operator MenuItem(Element)
Implicitly converts an Element to an instance of this class.
public static implicit operator MenuItem(Element element)
Parameters
elementElementThe element to convert.
Returns
- MenuItem
The MenuItem.
Exceptions
- ArgumentNullException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
implicit operator MenuItem(string)
Implicitly converts a string to an instance of this class by searching the root.
public static implicit operator MenuItem(string path)
Parameters
pathstringThe search path.
Returns
- MenuItem
The MenuItem.
Remarks
The DefaultSearchTimeout is used to search for the specified path.
Exceptions
- ArgumentNullException
If
pathisnull.- RxPathException
If the specified
pathis not valid.- ElementNotFoundException
If no element is found.
- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.