Getting wPosition Property
To determine the position of a seek bar slider, use the wPosition property. This property returns the current position of the seek bar slider. The following example shows how to obtain the seek bar position:
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 : 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 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);
}
Using From Keyword Tests
This topic explains how to determine the current position of the seek bar control in scripts. You can use the described property 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 Minimum and Maximum Seek Bar Positions