wButtonCount Property (Specific to iOS AlertView Object)

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

Use the wButtonCount property to obtain the total number of buttons on the alert view.

Declaration

TestObj.wButtonCount

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

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.

Property Value

An integer value holding the total number of control’s buttons.

Example

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
  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.wButtonCount;i++)
    Log.Message(alertview.wButtonText(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.wButtonCount):
    Log.Message(alertview.wButtonText[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.wButtonCount-1
    Log.Message(AView.wButtonText(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.wButtonCount-1 do
    Log.Message(alertview.wButtonText(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["wButtonCount"];i++)
    Log["Message"](alertview["wButtonText"](i));
}

See Also

Getting the Number of Alert View's Buttons and Fields
iOS AlertView Support
wButtonText Property (Specific to iOS AlertView Object)

Highlight search results