wButtonText Property (Specific to iOS AlertView Object)

Applies to TestComplete 15.65, last modified on July 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.


Use the wButtonText property to get the caption of the alert view button specified by the Index parameter.



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    

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.


The property has the following parameter:


Specifies the zero-based index of the button you want to get.

Property Value

A string value holding the caption of the specified alert view button.


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


The following example gets the text of all buttons in the alert view and posts them to the log.

JavaScript, JScript

function Test()
  // Select the mobile device
  // Obtain the AlertView object
  var p = Mobile.Device().Process("SampleApp");
  var alertview = p.Window(2).AlertView("Alert title");
  for (var i=0; i<alertview.wButtonCount;i++)


def Test():
  # Select the mobile device
  # Obtain the AlertView object
  p = Mobile.Device().Process("SampleApp")
  alertview = p.Window(2).AlertView("Alert title")
  for i in range (0, alertview.wButtonCount):


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


procedure Test();
  p, alertview, i;
  // Select the mobile device
  // Obtain the AlertView object
  p := Mobile.Device.Process('SampleApp');
  alertview := p.Window(2).AlertView('Alert title');
  for i := 0 to alertview.wButtonCount-1 do

C++Script, C#Script

function Test()
  // Select the mobile device
  // Obtain the AlertView object
  var p = Mobile["Device"].Process("SampleApp");
  var alertview = p["Window"](2)["AlertView"]("Alert title");
  for (var i=0; i<alertview["wButtonCount"];i++)

See Also

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

Highlight search results