Determining Slider Position

Applies to TestComplete 15.70, last modified on December 17, 2024
Getting wPosition Property

To determine the position of a slider, use the wPosition property. This property returns the current position of the slider. The following example shows how to obtain the slider position:

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(0).Slider(1);
  // Post slider position to the log
  Log.Message(slider.wPosition);
}

Python

def Test():
  # Select the mobile device
  Mobile.SetCurrent("iPhone")
  # Obtain the slider object
  p = Mobile.Device().Process("SampleApp")
  slider = p.Window(0).Slider(1)
  # Post slider position to the log
  Log.Message(slider.wPosition)

VBScript

Sub Test()
  Dim p, slider
  ' Select the mobile device
  Mobile.SetCurrent("iPhone")
  ' Obtain the slider object
  Set p = Mobile.Device.Process("SampleApp")
  Set slider = p.Window(0).Slider(1)
  ' Post slider position to the log
  Log.Message(slider.wPosition)
End Sub

DelphiScript

procedure Test();
var
  p, slider;
begin
  // Select the mobile device
  Mobile.SetCurrent('iPhone');
  // Obtain the slider object
  p := Mobile.Device.Process('SampleApp');
  slider := p.Window(0).Slider(1);
  // Post slider position to the log
  Log.Message(slider.wPosition)
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"](0)["Slider"](1)
  // Post slider position to the log
  Log["Message"](slider["wPosition"])
}

Determining Slider Position From Keyword Tests

To determine the slider position from keyword tests, use the On-Screen Action or Call Object Method operation to access the properties described above. See Getting and Setting Object Property Values.

See Also

Working With iOS Slider Controls
Determining Minimum and Maximum Slider Positions

Highlight search results