Class MobileUiElement
- Namespace
- Ranorex
- Assembly
- Ranorex.Plugin.Mobile.dll
General capability for UI elements of a mobile device.
public class MobileUiElement : Adapter, IAdapter
- Inheritance
-
MobileUiElement
- Implements
- Inherited Members
Constructors
MobileUiElement()
Creates a new MobileUiElement adapter instance. This constructor is used internally by the Ranorex Core Framework for performance issues!
protected MobileUiElement()
MobileUiElement(Element)
Creates a new MobileUiElement adapter instance.
public MobileUiElement(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
AccessibilityId
The accessibility ID specified for the control.
public virtual string AccessibilityId { get; }
Property Value
AccessibilityLabel
The accessibility label specified for the control.
public virtual string AccessibilityLabel { get; }
Property Value
PlatformClass
The concrete class name of the UI element. E.g. for an android button it will be 'android.widget.button'.
public virtual string PlatformClass { get; }
Property Value
RequiredCapabilities
Capabilities required by the adapter implementation.
protected override string[] RequiredCapabilities { get; }
Property Value
- string[]
TemporaryElementId
A temporary ID that is only valid throughout a single Spy/Recorder session. Don't use this ID for element identification.
public virtual int TemporaryElementId { get; }
Property Value
Methods
FromElement(Element)
Converts an Element to an instance of this class.
public static MobileUiElement FromElement(Element element)
Parameters
elementElementThe element to convert.
Returns
- MobileUiElement
The MobileUiElement.
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 MobileUiElement FromPath(string path)
Parameters
pathstringThe search path.
Returns
- MobileUiElement
The MobileUiElement.
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.
SetOrientation(DeviceOrientation)
Sets the device orientation.
public virtual void SetOrientation(DeviceOrientation DeviceOrientation)
Parameters
DeviceOrientationDeviceOrientationThe orientation of the device. Possible values are 'Portrait', 'PortraitUpsideDown', 'LandscapeLeft', 'LandscapeRight', 'FaceUp' and 'FaceDown'.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
Touch(string)
Performs a touch event for the given element.
public virtual void Touch(string elementLocation)
Parameters
elementLocationstringLocation where the touch event should be triggered. Use a location string with the pattern 'x;y' e.g. '100;300' for pixel coordinates or '0.5;0.5' for relative coordinates like the center in this example. Alternatively, you can specify predefined locations that are 'Center', 'UpperLeft', 'UpperCenter', 'UpperRight', 'CenterLeft', 'Center', 'CenterRight', 'LowerLeft', 'LowerCenter', and 'LowerRight'.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
Operators
implicit operator MobileUiElement(Element)
Implicitly converts an Element to an instance of this class.
public static implicit operator MobileUiElement(Element element)
Parameters
elementElementThe element to convert.
Returns
- MobileUiElement
The MobileUiElement.
Exceptions
- ArgumentNullException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
implicit operator MobileUiElement(string)
Implicitly converts a string to an instance of this class by searching the root.
public static implicit operator MobileUiElement(string path)
Parameters
pathstringThe search path.
Returns
- MobileUiElement
The MobileUiElement.
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.