Determining Minimum and Maximum Slider Positions

Applies to TestComplete 15.10, last modified on December 15, 2021
Getting wMin and wMax Properties

To determine the minimum and maximum positions of a slider, use the wMin and wMax properties. These properties define the possible minimum and maximum values of the slider. The following example obtains the wMin and wMax properties and posts them 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(0).Slider(1);
  
  // Get the slider min and max positions
  var MinPos = slider.wMin;
  var MaxPos = slider.wMax;
   
  // Post slider position to the log
  Log.Message(MinPos);
  Log.Message(MaxPos);
}

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)
  
  # Get the slider min and max positions
  MinPos = slider.wMin
  MaxPos = slider.wMax
   
  # Post slider position to the log
  Log.Message(MinPos)
  Log.Message(MaxPos)

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)
  
  ' Get the slider min and max positions
  var MinPos = slider.wMin
  var MaxPos = slider.wMax
   
  ' Post slider position to the log
  Log.Message(MinPos)
  Log.Message(MaxPos)
End Sub

DelphiScript

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

Determining wMin and wMax Values From Keyword Tests

To determine the slider minimum and maximum positions 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 Slider Position

Highlight search results