AllowMockLocations Property

Applies to TestComplete 15.63, last modified on April 10, 2024
The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For new mobile tests, we recommend using the newer cloud-compatible approach.

Description

Specifies whether mock locations are allowed on the mobile device.

Declaration

Obj.AllowMockLocations

Read-Write Property Boolean
Obj An expression, variable or parameter that specifies a reference to object

Applies To

The property is applied to the following object:

Property Value

True if mock locations are allowed, and False otherwise.

Remarks

You can emulate mock locations only on cellular iOS devices.

Example

The following example enables mock locations and sets GPS coordinates:

JavaScript, JScript

function Test()
{
  Mobile.SetCurrent("MyDevice");
  Mobile.Device().GPS.AllowMockLocations = true;
  Mobile.Device().GPS.SetLocation(-73.9780035, 40.7056308);
}

Python

def Test():
  Mobile.SetCurrent('MyDevice')
  Mobile.Device().GPS.AllowMockLocations = True
  Mobile.Device().GPS.SetLocation(-73.9780035, 40.7056308)

VBScript

Sub Test()
  Mobile.SetCurrent("MyDevice")
  Mobile.Device.GPS.AllowMockLocations = true
  Call Mobile.Device.GPS.SetLocation(-73.9780035, 40.7056308)
End Sub

DelphiScript

procedure Test();
begin
  Mobile.SetCurrent('MyDevice');
  Mobile.Device.GPS.AllowMockLocations := true;
  Mobile.Device.GPS.SetLocation(-73.9780035, 40.7056308)
end;

C++Script, C#Script

function Test()
{
  Mobile["SetCurrent"]("MyDevice");
  Mobile["Device"].GPS["AllowMockLocations"] = true;
  Mobile["Device"].GPS["SetLocation"](-73.9780035, 40.7056308)
}

See Also

Testing Android Applications (Legacy)
Geolocation Testing (Legacy)
Working With Android Device Settings During Test Run (Legacy)
iOSGPS Object

Highlight search results