wPositionX Property (iOS Controls)

Applies to TestComplete 15.40, last modified on July 05, 2022
This property is available in legacy mobile tests that work with devices connected to the local computer. To learn how to simulate user actions in newer cloud-compatible mobile tests, see the Simulating user actions in tests section.

Description

A control's two-dimensional logical position is specified by horizontal and vertical offsets. Use the wPositionX property to get or set the current horizontal position of the control.

Declaration

TestObj.wPositionX

Read-Write Property Integer
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section

Applies To

The property is applied to the following objects:

View Mode

This property is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.

Property Value

An integer value that specifies the current horizontal position of the control.

Remarks

If the control has only vertical scrolling, the property always returns 0.

Example

JavaScript, JScript

function Test()
{
  // Select the mobile device
  Mobile.SetCurrent("iPhone");
  // Obtain the ScrollView object
  var p = Mobile.Device().Process("SampleApp");
  var scrollview = p.Window().ScrollView();
  
  Log.Message(scrollview.wPositionX);
  Log.Message(scrollview.wPositionY);
}

Python

def Test():
  # Select the mobile device
  Mobile.SetCurrent("iPhone")
  # Obtain the ScrollView object 
  p = Mobile.Device().Process("SampleApp")
  scrollview = p.Window().ScrollView()
  
  Log.Message(scrollview.wPositionX)
  Log.Message(scrollview.wPositionY)

VBScript

Sub Test()
  Dim p, scrollview
  ' Select the mobile device
  Mobile.SetCurrent("iPhone")
  ' Obtain the ScrollView object
  Set p = Mobile.Device.Process("SampleApp")
  Set scrollview = p.Window.scrollview
  
  Log.Message(scrollview.wPositionX)
  Log.Message(scrollview.wPositionY)
End Sub

DelphiScript

procedure Test();
var
  p, scrollview;
begin
  // Select the mobile device
  Mobile.SetCurrent('iPhone');
  // Obtain the ScrollView object
  p := Mobile.Device.Process('SampleApp');
  scrollview := p.Window.ScrollView;
  
  Log.Message(scrollview.wPositionX);
  Log.Message(scrollview.wPositionY);
end;

C++Script, C#Script

function Test()
{
  // Select the mobile device
  Mobile["SetCurrent"]("iPhone");
  // Obtain the ScrollView object
  var p = Mobile["Device"].Process("SampleApp");
  var scrollview = p["Window"]()["ScrollView"]();
  
  Log["Message"](scrollview["wPositionX"]);
  Log["Message"](scrollview["wPositionY"]);
}

See Also

Changing ScrollView Position
Scrolling Table View
Working With Multiline Edit Controls
wPositionY Property (iOS Controls)
iOS ScrollView Support

Highlight search results