wSelectedItem Property (Specific to iOS Picker View Controls)

Applies to TestComplete 14.0, last modified on January 23, 2019

Description

The wSelectedItem property specifies which item of the wheel is selected.

Declaration

TestObj.wSelectedItem(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

To view this property in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

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

An integer value that indicates the index of the selected item.

Remarks

If the specified item is not found, the property returns a null value (Nothing in VBScript, nil in DelphiScript, None in Python, null in JavaScript, JScript, C++Script and C#Script) and posts an error message to the test log.

If the specified item is not checkable, the wSelectedItem property returns False.

Example

The following example iterates through picker view wheels and posts the index of the selected 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++)
    Log.Message(pickerview.wSelectedItem(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):
    Log.Message(pickerview.wSelectedItem[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
    Log.Message(pickerview.wSelectedItem(i))
  Next
End Sub

DelphiScript

procedure Test();
var
  p, pickerview, i;
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
    Log.Message(pickerview.wSelectedItem(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++)
    Log["Message"](pickerview["wSelectedItem"](i))
}

See Also

About Testing Android Applications
iOS PickerView Support
Getting the Selected Picker View Item

Highlight search results