wItem Property (Android ExpandableList Controls)

Applies to TestComplete 15.70, last modified on December 17, 2024
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 to get the name of the specified item of the control's group.

Declaration

TestObj.wItem(Group, Index)

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
Group [in]    Required    Variant    
Index [in]    Required    Integer    

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:

Group

Specifies the desired group. You can enter the group’s index (from 0) or its name.

The caption can contain asterisk (*) or question mark (?) wildcards or regular expressions. The asterisk corresponds to a string of any length (including an empty string), the question mark corresponds to any single character (including none). To specify more complicated parts of a caption, use regular expressions.

The caption can be case-sensitive or case-insensitive depending on the value of the Use case-sensitive parameters project setting.

Index

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

Property Value

The name of the specified item.

Remarks

To obtain the item’s name, TestComplete uses the getText() native method. If a child item does not support this method, the wItem property returns an empty string.

Example

JavaScript, JScript

function Test()
{
  // Select an Android device
  Mobile.SetCurrent("MyDevice");

  // Obtain an application
  var app = Mobile.Device().Process("com.example.myapp");

  // Obtain an expandable list
  var expList = app.RootLayout("").ExpandableListView("list");
  
  for (i=0; i<expList.wItemCount(0); i++)
  {
    // Obtain the name of the item
    itemName = expList.wItem(0, i);
    
    // Print the name to the log
    Log.Message(itemName);
  }
}

Python

def Test(): 
  # Select an Android device
  Mobile.SetCurrent("MyDevice")

  # Obtain an application
  app = Mobile.Device().Process("com.example.myapp")

  # Obtain an expandable list
  expList = app.RootLayout("").ExpandableListView("list")
  
  for i in range (0, expList.wItemCount(0)):
    # Obtain the name of the item
    itemName = expList.wItem[0, i]
    
    # Print the name to the log
    Log.Message(itemName)

VBScript

Sub Test()
  ' Select an Android device
  Mobile.SetCurrent("MyDevice")

  ' Obtain an application
  Set app = Mobile.Device.Process("com.example.myapp")

  ' Obtain an expandable list
  expList = app.RootLayout("").ExpandableListView("list")
  
  For i=0 to expList.wItemCount(0) -1

  ' Obtain the name of the item
    itemName = expList.wItem(0, i)

  ' Print the name to the log
    Log.Message(itemName)
  Next
  
End Sub

DelphiScript

procedure Test();
var
  app, expList, i, itemName: OleVariant;
begin
  // Select an Android device
  Mobile.SetCurrent('MyDevice');

  // Obtain an application
  app := Mobile.Device.Process('com.example.myapp');

  // Obtain an expandable list
  expList := app.RootLayout('').ExpandableListView('list');
  
  For i:=0 to expList.wItemCount(0) do
  begin
    
    // Obtain the name of the item
    itemName := expList.wItem(0, i);
    
    // Print the name to the log
    Log.Message(itemName)
  end;
end;

C++Script, C#Script

function Test()
{
  // Select an Android device
  Mobile["SetCurrent"]("MyDevice");

  // Obtain an application
  var app = Mobile["Device"]["Process"]("com.example.myapp");

  // Obtain an expandable list
  var expList = app["RootLayout"]("")["ExpandableListView"]("list");
  
  for (i=0; i<expList["wItemCount"](0); i++)
  {
    // Obtain the name of the item
    itemName = expList["wItem"](0, i);
    
    // Print the name to the log
    Log["Message"](itemName);
  }
}

See Also

About Testing Android Applications (Legacy)
Addressing Expandable List Groups and Items
wItem Property (Mobile Controls)
wItemCount Property (Mobile Controls)
wFocus Property (Android Controls)
wSelected Property (Android Controls)

Highlight search results