wPosition Property (Specific to iOS Slider Controls)

Applies to TestComplete 15.62, last modified on March 19, 2024
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

Use the wPosition property to get or set the current logical position of the slider. This value must be within the range wMinwMax (the bounds are included).

Declaration

TestObj.wPosition

Read-Write Property Double
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 object:

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

A float value specifying the current position of the slider.

Remarks

  • If you assign a value to wPosition and this value is greater than wMax (or less than wMin), it will be automatically replaced with the wMax (or wMin) value.

Example

The following example obtains the wPosition property and posts it to the log:

JavaScript, JScript

function Test()
{

  // Select the mobile device
  Mobile.SetCurrent("iPhone");

  // Obtain the slider object
  var p = Mobile.Device().Process("SampleApp");
  var slider = p.Window().TableView().TableViewCell(2).ScrollView().Slider();

  // Get the slider position
  var pos = slider.wPosition;

  // Post the position to the log
  Log.Message(pos);

}

Python

def Test():

  # Select the mobile device
  Mobile.SetCurrent("iPhone")

  # Obtain the slider object
  p = Mobile.Device().Process("SampleApp")
  slider = p.Window().TableView().TableViewCell(2).ScrollView().Slider()

  # Get the slider position
  pos = slider.wPosition

  # Post the position to the log
  Log.Message(pos)

VBScript

Sub Test

  ' Select the mobile device
  Mobile.SetCurrent("iPhone")

  ' Obtain the slider object
  Set p = Mobile.Device.Process("SampleApp")
  Set slider = p.Window.TableView.TableViewCell(2).ScrollView.Slider

  ' Get the slider position
  pos = slider.wPosition

  ' Post the position to the log
  Log.Message pos

End Sub

DelphiScript

procedure Test();
var p, slider, pos;
begin

  // Select the mobile device
  Mobile.SetCurrent('iPhone');

  // Obtain the slider object
  p := Mobile.Device.Process('SampleApp');
  slider := p.Window().TableView().TableViewCell(2).ScrollView().Slider();

  // Get the slider position
  pos := slider.wPosition;

  // Post the position to the log
  Log.Message(pos);

end;

C++Script, C#Script

function Test()
{

  // Select the mobile device
  Mobile["SetCurrent"]("iPhone");

  // Obtain the slider object
  var p = Mobile["Device"]["Process"]("SampleApp");
  var slider = p["Window"]()["TableView"]()["TableViewCell"](2)["ScrollView"]()["Slider"]();

  // Get the slider position
  var pos = slider["wPosition"];

  // Post the position to the log
  Log["Message"](pos);

}

See Also

Testing iOS Applications (Legacy)
Determining Slider Position
wMax Property (Specific to iOS Slider Controls)
wMin Property (Specific to iOS Slider Controls)

Highlight search results