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
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
Pressed
True if the button is currently pressed.
public virtual bool Pressed { get; }
Property Value
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
Methods
FromElement(Element)
Converts an Element to an instance of this class.
public static Button FromElement(Element element)
Parameters
elementElementThe element to convert.
Returns
- Button
The Button.
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 Button FromPath(string path)
Parameters
pathstringThe search path.
Returns
- Button
The Button.
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.
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
elementElementThe element to convert.
Returns
- Button
The Button.
Exceptions
- ArgumentNullException
If
elementisnull.- 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
pathstringThe search path.
Returns
- Button
The Button.
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.