Determining Minimum and Maximum Seek Bar Positions

Applies to TestComplete 14.93, last modified on October 12, 2021
Getting wMin and wMax Properties

To determine the minimum and maximum positions of a seek bar slider, use the wMin and wMax properties. These properties define the possible minimum and maximum values of the seek bar. The following example obtains the wMin and wMax properties and posts them to the log:

JavaScript, JScript

function Test()
{
  // Select the Android device
  Mobile.SetCurrent("MyDevice");
  
  // Obtain the SeekBar object
  var p = Mobile.Device().Process("com.example.myapp");
  var SeekBar = p.RootLayout("").Layout("layoutTop").Layout("layout2").SeekBar("seekbar1");
  
  // Get the SeekBar minimum and maximum positions
  var MinPosition = SeekBar.wMin;
  var MaxPosition = SeekBar.wMax;
   
  // Post the position to the log
  Log.Message(MinPosition);
  Log.Message(MaxPosition);
}

Python

def Test():
  # Select the Android device
  Mobile.SetCurrent("MyDevice")
  
  # Obtain the SeekBar object
  p = Mobile.Device().Process("com.example.myapp")
  SeekBar = p.RootLayout("").Layout("layoutTop").Layout("layout2").SeekBar("seekbar1")
  
  # Get the SeekBar minimum and maximum positions
  MinPosition = SeekBar.wMin
  MaxPosition = SeekBar.wMax
   
  # Post the position to the log
  Log.Message(MinPosition)
  Log.Message(MaxPosition)

VBScript

Sub Test()
  Dim p, SeekBar, MinPosition, MaxPosition

  ' Select the Android device
  Mobile.SetCurrent("MyDevice")
  
  ' Obtain the SeekBar object
  Set p = Mobile.Device.Process("com.example.myapp")
  Set SeekBar = p.RootLayout("").Layout("layoutTop").Layout("layout2").SeekBar("seekbar1")
  
  ' Get the SeekBar minimum and maximum positions
  MinPosition = SeekBar.wMin
  MaxPosition = SeekBar.wMax
   
  ' Post the position to the log
  Log.Message(MinPosition)
  Log.Message(MaxPosition)
End Sub

DelphiScript

procedure Test();
var 
  p, SeekBar, MaxPosition, MinPosition : OleVariant;
begin
  // Select the Android device
  Mobile.SetCurrent('MyDevice');
  
  // Obtain the SeekBar object
  p := Mobile.Device.Process('com.example.myapp');
  SeekBar := p.RootLayout('').Layout('layoutTop').Layout('layout2').SeekBar('seekbar1');
  
  // Get the SeekBar minimum and maximum positions
  MinPosition := SeekBar.wMin;
  MaxPosition := SeekBar.wMax;
   
  // Post the position to the log
  Log.Message(MinPosition);
  Log.Message(MaxPosition);
end;

C++Script, C#Script

function Test()
{
  // Select the Android device
  Mobile["SetCurrent"]("MyDevice");
  
  // Obtain the SeekBar object
  var p = Mobile["Device"]["Process"]("com.example.myapp");
  var SeekBar = p["RootLayout"]("")["Layout"]("layoutTop")["Layout"]("layout2")["SeekBar"]("seekbar1");
  
  // Get the SeekBar minimum and maximum positions
  var MinPosition = SeekBar["wMin"];
  var MaxPosition = SeekBar["wMax"];
   
  // Post the position to the log
  Log["Message"](MinPosition);
  Log["Message"](MaxPosition);
}

Using From Keyword Testing

This topic explains how to get the minimum and maximum values of the seek bar control in scripts. You can use the described properties in keyword tests too. To do this, use the On-Screen Action or the Call Object Method operations.

See Also

Working With Android Seek Bar Controls
Determining the Seek Bar Position

Highlight search results