PressHome Method

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

Simulates pressing the Home key on the device.

Declaration

AndroidDeviceObj.PressHome()

AndroidDeviceObj An expression, variable or parameter that specifies a reference to an AndroidDevice object
Result None

Applies To

The method is applied to the following object:

Result Value

None.

Example

The example below demonstrates how to use the PressHome method to simulate pressing the Home button on a mobile device:

JavaScript, JScript

function Test()
{
  // Specify the current device
  Mobile.SetCurrent("MyDevice");

  // Simulate user actions
  …
  Mobile.Device().PressHome();
  …

}

Python

def Test():
  # Specify the current device
  Mobile.SetCurrent("MyDevice")

  # Simulate user actions
  # ...
  Mobile.Device().PressHome()
  # ...

VBScript

Sub Test

  ' Specify the current device
  Call Mobile.SetCurrent("MyDevice")

  ' Simulate user actions
  …
  Call Mobile.Device.PressHome()
  …

End Sub

DelphiScript

procedure Test;
begin
  // Specify the current device
  Mobile.SetCurrent('MyDevice');

  // Simulate user actions
  …
  Mobile.Device.PressHome();
  …

end;

C++Script, C#Script

function Test()
{
  // Specify the current device
  Mobile["SetCurrent"]("MyDevice");

  // Simulate user actions
  …
  Mobile["Device"]["PressHome"]();
  …

}

See Also

Testing Android Applications
AndroidDevice Object

Highlight search results