wPosition Property (Android Controls)

Applies to TestComplete 15.62, last modified on March 19, 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 wPosition property to get or set the current logical position of the control’s slider. This value must be within the range wMin...wMax (bounds are included).

Declaration

TestObj.wPosition

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 objects:

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 wPosition and this value is greater than wMax (or less than wMin), it will be automatically replaced with wMax (or wMin) value, and an error message will be posted to the log.

Example

The following example obtains the wPosition 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 SeekBar = p.RootLayout("").Layout("layoutTop").Layout("layout2").SeekBar("seekbar1");
  
  // Get the SeekBar position
  var Position = SeekBar.wPosition;
  
  // 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")
  SeekBar = p.RootLayout("").Layout("layoutTop").Layout("layout2").SeekBar("seekbar1")
  
  # Get the SeekBar position
  Position = SeekBar.wPosition
  
  # 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 SeekBar object
  Set p = Mobile.Device.Process("com.example.myapp")
  Set SeekBar = p.RootLayout("").Layout("layoutTop").Layout("layout2").SeekBar("seekbar1")
  
  ' Get the SeekBar position
  Position = SeekBar.wPosition
  
  ' Post the position to the log
  Log.Message(Position)
End Sub

DelphiScript

procedure Test();
var 
  p, SeekBar, Position;
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 position
  Position := SeekBar.wPosition;
  
  // 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 SeekBar = p["RootLayout"]("")["Layout"]("layoutTop")["Layout"]("layout2")["SeekBar"]("seekbar1");
  
  // Get the SeekBar position
  var Position = SeekBar["wPosition"];
  
  // Post the position to the log
  Log["Message"](Position);
}

See Also

About Testing Android Applications (Legacy)
Determining the Scroll View Position
Determining the Seek Bar Position
wMax Property (Android Controls)
wMin Property (Android Controls)

Highlight search results