General Notes
TestComplete can recognize alert view controls of iOS Open Applications. This allows you to simulate actions on alert views using their methods and properties.
Specifics of Working With Alert View Items
Alert view controls can include two types of objects: Buttons and Fields. Fields allow you to enter text; buttons are used to make a choice. Alert views also include a title and an optional message. For more information on getting an alert view’s title and message, see Getting Alert View Title and Message
Waiting for Alert View
It may take time for the alert view to appear. You can delay script execution until it becomes active. For more information on waiting for iOS objects, see Waiting for Objects in iOS Applications (Legacy) topic.
Addressing Buttons and Fields of Alert View Controls
When entering text in fields or touching buttons, you can address them using their captions. Depending on the Use case-sensitive parameters project option, TestComplete treats the captions of buttons and fields as case-sensitive or case-insensitive. By default, this option is turned off, so you can ignore the letter case:
If the Use case-sensitive parameters option is checked, you need to use the appropriate case when specifying the captions:
Using Wildcards in Captions
Field text may change depending on the current application context. So, it is useful to address it only by the constant part of the text. To specify variable parts of text, you can use wildcard characters (* and ?) 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.
For example, your tested application’s alert view contains the UserName field whose contents depend on the user who is working with it: the text may be User1, TestUser, or Enter user name, if no user is logged in. In order to ensure recognition of the UserName field, you can replace the variable parts of the text with the * wildcard:
alertview.SetText("*User*", "TestUser")
In this example, we placed a wildcard on both sides of the word User, since it can either precede or follow other text.