wItem Property (iOS Picker View Controls)

Applies to TestComplete 15.48, last modified on March 01, 2023
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 wItem property to get the caption of a control’s item specified by its index.

Declaration

TestObj.wItem(Index, Wheel)

Read-Only Property String
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Index [in]    Required    Integer    
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 parameters:

Index

Specifies the index of the item whose caption you want to get. The index is zero-based, that is, the first item has index 0, the second - 1, and so on. The index of the last item is wItemCount - 1.

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 caption of the specified item.

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

Getting Picker View Item Text
Testing iOS Applications (Legacy)
wItem Property (iOS Picker View Controls)

Highlight search results