AllowMockLocations Property

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

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
Geolocation Testing
Working With Android Device Settings During Test Run
iOSGPS Object

Highlight search results