Class MobileDevice
- Namespace
- Ranorex
- Assembly
- Ranorex.Plugin.Mobile.dll
Represents the capability of a mobile device that is connected to Ranorex.
public class MobileDevice : Adapter, IAdapter
- Inheritance
-
MobileDevice
- Implements
- Inherited Members
Constructors
MobileDevice()
Creates a new MobileDevice adapter instance. This constructor is used internally by the Ranorex Core Framework for performance issues!
protected MobileDevice()
MobileDevice(Element)
Creates a new MobileDevice adapter instance.
public MobileDevice(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
ActiveApplication
The currently running application on the device.
public virtual string ActiveApplication { get; }
Property Value
AppConnectionEstablished
When set to true, Ranorex was able to successfully establish a connection with the currently running app on the device.
public virtual bool AppConnectionEstablished { get; }
Property Value
Device
The name that was given to the device. This name is used to identify the device and can be changed in the Ranorex device service.
public virtual string Device { get; }
Property Value
DeviceConnectionEstablished
When set to true, Ranorex was able to successfully connect to the Ranorex service installed on the device.
public virtual bool DeviceConnectionEstablished { get; }
Property Value
DeviceId
An ID assigned to the device by the manufacturer.
public virtual string DeviceId { get; }
Property Value
DeviceType
The platform of the device (e.g. Android).
public virtual string DeviceType { get; }
Property Value
DisplayName
A descriptive name for the device. This name can be set to anything that helps you to identify the device.
public virtual string DisplayName { get; }
Property Value
InvalidConnectionAttempts
Shows how many consecutive times a connection attempt failed.
public virtual int InvalidConnectionAttempts { get; }
Property Value
LastConnectionError
A message describing the last error that occurred while trying to establish a connection with the device.
public virtual string LastConnectionError { get; }
Property Value
Manufacturer
The manufacturer of the device.
public virtual string Manufacturer { get; }
Property Value
OSVersion
Name and version number of the device mobile platform.
public virtual string OSVersion { get; }
Property Value
Port
The port the device is listening on for incoming connections. The default port is 31000.
public virtual int Port { get; }
Property Value
RequiredCapabilities
Capabilities required by the adapter implementation.
protected override string[] RequiredCapabilities { get; }
Property Value
- string[]
Methods
FetchStartableApps()
Gets a list of application identifiers that can be used with Host.RunMobileApp to start an app on the device from within the Ranorex system.
public virtual void FetchStartableApps()
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
FromElement(Element)
Converts an Element to an instance of this class.
public static MobileDevice FromElement(Element element)
Parameters
elementElementThe element to convert.
Returns
- MobileDevice
The MobileDevice.
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 MobileDevice FromPath(string path)
Parameters
pathstringThe search path.
Returns
- MobileDevice
The MobileDevice.
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.
PressBackKey()
Presses the hardware back key on the device.
public virtual void PressBackKey()
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
StartApp(string, bool)
Starts an app on the device.
public virtual string StartApp(string App, bool ResetInitialState)
Parameters
AppstringThe package name of the application to start e.g. 'ranorex.services'. Use the FetchStartableApps command to get a list of valid values from the device.
ResetInitialStateboolIndicates if the app should be restarted on launch or just brought to the foreground in case the app is already running.
Returns
- string
The value that will be returned by the action invocation.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
Operators
implicit operator MobileDevice(Element)
Implicitly converts an Element to an instance of this class.
public static implicit operator MobileDevice(Element element)
Parameters
elementElementThe element to convert.
Returns
- MobileDevice
The MobileDevice.
Exceptions
- ArgumentNullException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
implicit operator MobileDevice(string)
Implicitly converts a string to an instance of this class by searching the root.
public static implicit operator MobileDevice(string path)
Parameters
pathstringThe search path.
Returns
- MobileDevice
The MobileDevice.
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.