Description
The iOSDesktop object provides information on the display of the connected iOS device. To get the object in tests, use the Mobile.Device.Desktop property.
The iOSDesktop object has the following properties and methods:
Properties
| Property | Description |
|---|---|
Height |
Returns the height of the display in pixels. Integer. |
Width |
Returns the width of the display in pixels. Integer. |
Methods
| Method | Description |
|---|---|
GetOrientation |
Returns the current orientation of the device's screen. |
Picture |
Returns the specified rectangular area of the screen as an image. |
SetOrientation |
Sets the current orientation of the device's screen. |
Example
The following code gets the iOSDesktop object and posts the value of its properties to the test log:
JavaScript, JScript
function GetDeskInfo()
{
var DeskObj = Mobile.Device("iOSDevice").Desktop;
Log.Message("Width: " + DeskObj.Width);
Log.Message("Height: " + DeskObj.Height);
}
Python
def GetDeskInfo():
DeskObj = Mobile.Device("iOSDevice").Desktop
Log.Message("Width: " + VarToStr(DeskObj.Width))
Log.Message("Height: " + VarToStr(DeskObj.Height))
VBScript
Sub GetDeskInfo
Set DeskObj = Mobile.Device("iOSDevice").Desktop
Log.Message("Width: " & VarToStr(DeskObj.Width))
Log.Message("Height: " & VarToStr(DeskObj.Height))
End Sub
DelphiScript
procedure GetDeskInfo();
var DeskObj;
begin
DeskObj := Mobile.Device('iOSDevice').Desktop;
Log.Message('Width: ' + VarToStr(DeskObj.Width));
Log.Message('Height: ' + VarToStr(DeskObj.Height));
end;
C++Script, C#Script
function GetDeskInfo()
{
var DeskObj = Mobile["Device"]("iOSDevice")["Desktop"];
Log["Message"]("Width: " + DeskObj["Width"]);
Log["Message"]("Height: " + DeskObj["Height"]);
}
See Also
Testing iOS Applications
Desktop Property
AndroidDesktop Object
Desktop Object
