Assigning wValue Property
To assign a position to a number picker, use the wValue
property. This property allows you to specify a value between the minimum and the maximum values of the number picker. When you assign the position, no message is added to the test 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");
// Assign the new value to wValue property
NumberPicker.wValue = 10;
}
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")
# Assign the new value to wValue property
NumberPicker.wValue = 10
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")
' Assign the new value to wValue property
NumberPicker.wValue = 10
End Sub
DelphiScript
function Test();
var
p, NumberPicker : 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');
// Assign the new value to wValue property
NumberPicker.wValue := 10;
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");
// Assign the new value to wValue property
NumberPicker["wValue"] = 10;
}
If you try to assign the value above wMax or below wMin , the error message will be posted to the log and the wMax or wMin value will be assigned instead. |
Using From Keyword Tests
This topic explains how to change the position of the number picker control in scripts. You can use the described method 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