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 wItemCount
property to get the total number of items in the specified control.
Declaration
TestObj.wItemCount(Wheel)
Read-Only Property | Integer |
TestObj | A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section | |||
Wheel | [in] | Optional | Integer | Default value: 0 |
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.
Parameters
The property has the following parameter:
Wheel
Specifies the index (from 0) of the wheel to work with. If it is not specified, the first wheel is used.
Property Value
The total number of items in the control (including separators).
Remarks
You can use the wItemCount
and wItem
properties to iterate through a control’s items.
Example
The following example iterates through picker view wheels and posts the items to the log.
JavaScript, JScript
function Test()
{
// Select the mobile device
Mobile.SetCurrent("iPhone");
// Obtain the PickerView object
var p = Mobile.Device().Process("SampleApp");
var pickerview = p.Window(3).PickerView();
for (var i=0; i<pickerview.wWheelCount; i++)
for (var n=0; n<pickerview.wItemCount(i); n++)
Log.Message(pickerview.wItem(n, i))
}
Python
def Test():
# Select the mobile device
Mobile.SetCurrent("iPhone")
# Obtain the PickerView object
p = Mobile.Device().Process("SampleApp")
pickerview = p.Window(3).PickerView()
for i in range (0, pickerview.wWheelCount):
for n in range (0, pickerview.wItemCount[i]):
Log.Message(pickerview.wItem[n, i])
VBScript
Sub Test()
Dim p, pickerview
' Select the mobile device
Mobile.SetCurrent("iPhone")
' Obtain the PickerView object
Set p = Mobile.Device.Process("SampleApp")
Set pickerview = p.Window(3).PickerView
For i = 0 To pickerview.wWheelCount-1
For n = 0 To pickerview.wItemCount
Log.Message(pickerview.wItem(n, i))
Next
Next
End Sub
DelphiScript
procedure Test();
var
p, pickerview, i, n;
begin
// Select the mobile device
Mobile.SetCurrent('iPhone');
// Obtain the PickerView object
p := Mobile.Device.Process('SampleApp');
pickerview := p.Window(3).PickerView;
for i := 0 to pickerview.wWheelCount-1 do
for n := 0 to pickerview.wItemCount(i)-1 do
Log.Message(pickerview.wItem(n, i))
end;
C++Script, C#Script
function Test()
{
// Select the mobile device
Mobile["SetCurrent"]("iPhone");
// Obtain the PickerView object
var p = Mobile["Device"].Process("SampleApp");
var pickerview = p["Window"](3)["PickerView"]();
for (var i=0; i<pickerview["wWheelCount"]; i++)
for (var n=0; n<pickerview["wItemCount"](i); n++)
Log["Message"](pickerview["wItem"](n, i))
}
See Also
Working With iOS Picker View Controls - Basic Concepts
Testing iOS Applications (Legacy)
wItem Property (iOS Picker View Controls)