Table of Contents

Class Button

Namespace
Ranorex
Assembly
Ranorex.Core.dll

Represents a push button.

public class Button : Adapter, IAdapter
Inheritance
Button
Implements
Inherited Members

Constructors

Button()

Creates a new Button adapter instance. This constructor is used internally by the Ranorex Core Framework for performance issues!

protected Button()

Button(Element)

Creates a new Button adapter instance.

public Button(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

Pressed

True if the button is currently pressed.

public virtual bool Pressed { get; }

Property Value

bool

RequiredCapabilities

Capabilities required by the adapter implementation.

protected override string[] RequiredCapabilities { get; }

Property Value

string[]

Text

The text associated with the button.

public virtual string Text { get; }

Property Value

string

Methods

FromElement(Element)

Converts an Element to an instance of this class.

public static Button FromElement(Element element)

Parameters

element Element

The element to convert.

Returns

Button

The Button.

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 Button FromPath(string path)

Parameters

path string

The search path.

Returns

Button

The Button.

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.

Press()

Presses the button.

public virtual void Press()

Exceptions

ActionFailedException

Thrown if invoking the action failed.

Operators

implicit operator Button(Element)

Implicitly converts an Element to an instance of this class.

public static implicit operator Button(Element element)

Parameters

element Element

The element to convert.

Returns

Button

The Button.

Exceptions

ArgumentNullException

If element is null.

CapabilityNotSupportedException

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

implicit operator Button(string)

Implicitly converts a string to an instance of this class by searching the root.

public static implicit operator Button(string path)

Parameters

path string

The search path.

Returns

Button

The Button.

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.