Page tree
Skip to end of metadata
Go to start of metadata

Alert capabilities allow you to configure an auto-accept/dismiss of iOS popup alerts.

Name

Possible Values

Notes

autoAcceptAlerts

true / false

Default: false

The alert popup will be accepted and disappear immediately on any element related to consecutive operation which executed after the popup appeared

  • Alert with a title: "Trust This Computer?" will tap "Trust" button
  • Alert with a single button will automatically be closed
  • Tap on the button that contains: 'OK', 'Allow','Always Allow', 'Accept','Continue','Yes'
autoDismissAlerts


true / false

Default: basic alerts being handled, pls see notes

False - Does not handle alerts!


Note the following is case-insensitive.

Default - Handles the following:

  • Trust This Computer?
  • Untrusted .*Developer
  • No sim card installed
  • Trust this computer?
  • Software update
  • iPhone is not activated
  • Sign In to iTunes Store
  • Apple ID Verification
  • Carrier Settings Update
  • Your carrier may charge for SMS messages used to activate iCloud
  • Your Apple ID and phone number are now being used for
  • Your Apple ID is now being used for


True - Adds the following in addition to the previous:

  • Clicks all alerts with a single button.
  • Clicks on alerts with button label containing:
    • Cancel
    • Later
    • Close
    • Not now
    • Dismiss
    • Ignore
  • Clicks on alerts with exact button label:
    • Allow
    • Always Allow
    • Continue
    • No
Example (Java)
@Test
public void test() throws MalformedURLException {
	IOSDriver<IOSElement> driver = null;
	try {
        DesiredCapabilities dc = new DesiredCapabilities();
        dc.setCapability("app", EIOSApps.CAMERA_AV.absolutePath);
        dc.setCapability("autoAcceptAlerts", true);
        driver = new IOSDriver<>(new URL(SERVER_URL), dc);

		// clicking on button causes a popup alert with "Don't allow" and "OK" buttons to appear
        driver.findElement(By.xpath("//*[@XCElementType='XCUIElementTypeButton']")).click();

		// clicking on a button behind the popup alert causes the popup to disappear
        driver.findElement(By.xpath("//*[@XCElementType='XCUIElementTypeButton'][3]")).click();
    } finally {
        if (driver != null) {
            driver.quit();
        }
    }
}

Dismissing Alerts

Replace "autoAcceptAlerts" with "autoDismissAlerts" to dismiss alerts

Supported for iOS 9 and above.

  • No labels