wFieldText Property (Specific to iOS AlertView Object)

Applies to TestComplete 15.47, last modified on January 20, 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 wFieldText property to get or set the caption of the alert view field specified by the Index parameter.

Declaration

TestObj.wFieldText(Index)

Read-Write 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    

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:

Index

Specifies the zero-based index of the field.

Property Value

A string value containing the caption of the specified alert view field.

Remarks

If you use Python or DelphiScript, you should enclose the parameter of the wIFieldText property in square brackets: wIFieldText[Item].

Example

The following example gets all fields in an alert view and posts their text to the log.

JavaScript, JScript

function Test()
{
  // Select the mobile device
  Mobile.SetCurrent("iPhone");
  // Obtain the AlertView object
  var p = Mobile.Device().Process("SampleApp");
  var alertview = p.Window(2).AlertView("Alert title");
  
  for (var i=0; i<alertview.wFieldCount;i++)
    Log.Message(alertview.wFieldText(i));
}

Python

def Test():
  # Select the mobile device
  Mobile.SetCurrent("iPhone")
  # Obtain the AlertView object 
  p = Mobile.Device().Process("SampleApp")
  alertview = p.Window(2).AlertView("Alert title")
  
  for i in range (0, alertview.wFieldCount):
    Log.Message(alertview.wFieldText[i])

VBScript

Sub Test()
  Dim p, AView
  ' Select the mobile device
  Mobile.SetCurrent("iPhone")
  ' Obtain the tableview object
  Set p = Mobile.Device.Process("SampleApp")
  Set AView = p.Window(2).AlertView("Alert title")
  
  For i = 0 To AView.wFieldCount-1
    Log.Message(AView.wFieldText(i))
  Next
End Sub

DelphiScript

procedure Test();
var
  p, alertview, i;
begin
  // Select the mobile device
  Mobile.SetCurrent('iPhone');
  // Obtain the AlertView object
  p := Mobile.Device.Process('SampleApp');
  alertview := p.Window(2).AlertView('Alert title');
  
  for i := 0 to alertview.wFieldCount-1 do
    Log.Message(alertview.wFieldText(i));
end;

C++Script, C#Script

function Test()
{
  // Select the mobile device
  Mobile["SetCurrent"]("iPhone");
  // Obtain the AlertView object
  var p = Mobile["Device"].Process("SampleApp");
  var alertview = p["Window"](2)["AlertView"]("Alert title");
  
  for (var i=0; i<alertview["wFieldCount"];i++)
    Log["Message"](alertview["wFieldText"](i));
}

See Also

Getting Alert View Button and Field Text
iOS AlertView Support
wFieldCount Property (Specific to iOS AlertView Object)

Highlight search results