Table of Contents

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

element Element

The element to create the adapter for.

Exceptions

NullReferenceException

If element is null.

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

bool

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

Image

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

string

Methods

FromElement(Element)

Converts an Element to an instance of this class.

public static MenuItem FromElement(Element element)

Parameters

element Element

The element to convert.

Returns

MenuItem

The MenuItem.

Exceptions

ArgumentNullException

If element is null.

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

path string

The search path.

Returns

MenuItem

The MenuItem.

Remarks

The DefaultSearchTimeout is used to search for the specified path.

Exceptions

ArgumentNullException

If path is null.

RxPathException

If the specified path is 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

element Element

The element to convert.

Returns

MenuItem

The MenuItem.

Exceptions

ArgumentNullException

If element is null.

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

path string

The search path.

Returns

MenuItem

The MenuItem.

Remarks

The DefaultSearchTimeout is used to search for the specified path.

Exceptions

ArgumentNullException

If path is null.

RxPathException

If the specified path is not valid.

ElementNotFoundException

If no element is found.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.