PressHome Method

Applies to TestComplete 14.30, last modified on November 21, 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.

Remarks

To record this method, press the appropriate emulated button in the Mobile Screen window of TestComplete.

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
Simulating Physical Button Events

Highlight search results