Table of Contents

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

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

AccessibilityId

The accessibility ID specified for the control.

public virtual string AccessibilityId { get; }

Property Value

string

AccessibilityLabel

The accessibility label specified for the control.

public virtual string AccessibilityLabel { get; }

Property Value

string

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

string

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

int

Methods

FromElement(Element)

Converts an Element to an instance of this class.

public static MobileUiElement FromElement(Element element)

Parameters

element Element

The element to convert.

Returns

MobileUiElement

The MobileUiElement.

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

Parameters

path string

The search path.

Returns

MobileUiElement

The MobileUiElement.

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.

SetOrientation(DeviceOrientation)

Sets the device orientation.

public virtual void SetOrientation(DeviceOrientation DeviceOrientation)

Parameters

DeviceOrientation DeviceOrientation

The 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

elementLocation string

Location 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

element Element

The element to convert.

Returns

MobileUiElement

The MobileUiElement.

Exceptions

ArgumentNullException

If element is null.

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

path string

The search path.

Returns

MobileUiElement

The MobileUiElement.

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.