Nexial Automation

Test Automation Platform for everyone!

X

mobile » saveAlertText(var)

Description

iOS only
This command saves the text of the current alert dialog to var.

Regarding Alert Dialog

Typically, an alert dialog requires immediate attention. It will block (as a modal component) all user interactions until it is dismissed. Hence, it is critical that we consider such condition as part of the automation. However, it is possible to automatically dismiss (or accept) alert dialog during automation, instead of explicitly checking for its presence and dismissing it. To do so, add the following configuration to the corresponding profile:

Automatically accept alerts (iOS only)
[profile].autoAcceptAlerts=true
Accept all iOS alerts automatically if they pop up. This includes privacy access permission alerts (e.g., location, contacts, photos). Default is `false`.

Automatically dismiss alerts (iOS only)
[profile].autoDismissAlerts=true
Dismiss all iOS alerts automatically if they pop up. This includes privacy access permission alerts (e.g., location, contacts, photos). Default is `false`.

Android support
Unfortunately, alert dialog support on Android is still lacking due to underlying driver implementation. However, for the alert dialog related to granting application permissions (during app installation), these alerts can be eliminated via the autoGrantPermissions configuration. Note that another configuration - noReset - must NOT be set to `true` in order for this to work. For example,
[profile].autoGrantPermissions=true
[profile].noReset=false

As stated above, this command is only supported on iOS platform. If the corresponding profile is configured to automatically dismiss or accept alert dialog, then this command will likely result in a FAIL for the corresponding step.

Parameters

  • var - The data variable name to store the alert dialog text.

Example

See Also