wValue Property (Android NumberPicker Object)

Applies to TestComplete 15.70, last modified on December 17, 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 wValue property to set or get the current value of the control. This value must be within the range wMin...wMax (the bounds are included).

Declaration

TestObj.wValue

Read-Write Property Integer
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

An integer value specifying the current position of the slider.

Remarks

  • If you assign a value to wValue and this value is greater than wMax (or less than wMin), it will be automatically replaced with the wMax (or wMin) value, and an error message will be posted to the log.

Example

The following example obtains the wValue property and posts it 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 NumberPicker = p.RootLayout("").Layout("layoutTop").Layout("layout2").NumberPicker("numberpicker1");
  
  // Get the NumberPicker position
  var Position = NumberPicker.wValue;
  
  // Post the position to the log
  Log.Message(Position);
}

Python

def Test():
  # Select the Android device
  Mobile.SetCurrent("MyDevice")
  
  # Obtain the SeekBar object
  p = Mobile.Device().Process("com.example.myapp")
  NumberPicker = p.RootLayout("").Layout("layoutTop").Layout("layout2").NumberPicker("numberpicker1")
  
  # Get the NumberPicker position
  Position = NumberPicker.wValue
  
  # Post the position to the log
  Log.Message(Position)

VBScript

Sub Test()
  Dim p, SeekBar, Position

  ' 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("layout2").NumberPicker("numberpicker1")
  
  ' Get the NumberPicker position
  Position = NumberPicker.wValue
  
  ' Post the position to the log
  Log.Message(Position)
End Sub

DelphiScript

procedure Test();
var 
  p, NumberPicker, Position;
begin
  // Select the Android device
  Mobile.SetCurrent('MyDevice');
  
  // Obtain the SeekBar object
  p := Mobile.Device.Process('com.example.myapp');
  NumberPicker := p.RootLayout('').Layout('layoutTop').Layout('layout2').NumberPicker('numberpicker1');
  
  // Get the SeekBar position
  Position := SeekBar.wValue;
  
  // Post the position to the log
  Log.Message(Position);
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 NumberPicker = p["RootLayout"]("")["Layout"]("layoutTop")["Layout"]("layout2")["NumberPicker"]("numberpicker1");
  
  // Get the NumberPicker position
  var Position = NumberPicker["wValue"];
  
  // Post the position to the log
  Log["Message"](Position);
}

See Also

About Testing Android Applications (Legacy)
Determining the Number Picker Value
wMax Property (Android Controls)
wMin Property (Android Controls)

Highlight search results