Determining Minimum and Maximum Number Picker Values

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

To determine the minimum and maximum values of a number picker, use the wMin and wMax properties. These properties define the possible minimum and maximum values of the number picker. 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 NumberPicker object
  var p = Mobile.Device().Process("com.example.myapp");
  var NumberPicker = p.RootLayout("").Layout("layoutTop").Layout("layoutNums").NumberPicker("numberPicker1");
  
  // Get the NumberPicker minimum and maximum values
  var MinValue = NumberPicker.wMin;
  var MaxValue = NumberPicker.wMax;
   
  // Post the values to the log
  Log.Message(MinValue);
  Log.Message(MaxValue);
}

Python

def Test():
  # Select the Android device
  Mobile.SetCurrent("MyDevice")
  
  # Obtain the NumberPicker object
  p = Mobile.Device().Process("com.example.myapp")
  NumberPicker = p.RootLayout("").Layout("layoutTop").Layout("layoutNums").NumberPicker("numberPicker1")
  
  # Get the NumberPicker minimum and maximum values
  MinValue = NumberPicker.wMin
  MaxValue = NumberPicker.wMax
   
  # Post the values to the log
  Log.Message(MinValue)
  Log.Message(MaxValue)

VBScript

Sub Test()
  ' Select the Android device
  Mobile.SetCurrent("MyDevice")
  
  ' Obtain the NumberPicker object
  Set p = Mobile.Device.Process("com.example.myapp")
  Set NumberPicker = p.RootLayout("").Layout("layoutTop").Layout("layoutNums").NumberPicker("numberPicker1")
  
  ' Get the NumberPicker minimum and maximum values
  MinValue = NumberPicker.wMin
  MaxValue = NumberPicker.wMax
   
  ' Post the values to the log
  Log.Message(MinValue)
  Log.Message(MaxValue)
End Sub

DelphiScript

function Test();
var
  p, NumberPicker, MinValue, MaxValue : OleVariant;
begin
  // Select the Android device
  Mobile.SetCurrent('MyDevice');
  
  // Obtain the NumberPicker object
  p := Mobile.Device.Process('com.example.myapp');
  NumberPicker := p.RootLayout('').Layout('layoutTop').Layout('layoutNums').NumberPicker('numberPicker1');
  
  // Get the NumberPicker minimum and maximum values
  MinValue := NumberPicker.wMin;
  MaxValue := NumberPicker.wMax;
   
  // Post the values to the log
  Log.Message(MinValue);
  Log.Message(MaxValue);
end;

C++Script, C#Script

function Test()
{
  // Select the Android device
  Mobile["SetCurrent"]("MyDevice");
  
  // Obtain the NumberPicker object
  var p = Mobile["Device"]["Process"]("com.example.myapp");
  var NumberPicker = p["RootLayout"]("")["Layout"]("layoutTop")["Layout"]("layoutNums")["NumberPicker"]("numberPicker1");
  
  // Get the NumberPicker minimum and maximum values
  var MinValue = NumberPicker["wMin"];
  var MaxValue = NumberPicker["wMax"];
   
  // Post the values to the log
  Log["Message"](MinValue);
  Log["Message"](MaxValue);
}

Using From Keyword Testing

This topic explains how to get the minimum and maximum values of the number picker 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 Number Picker Controls
Determining the Number Picker Value

Highlight search results