Handle mobile application or browser alerts with appium

mobileAlertsWe have seen how to handle alerts for desktop browsers using selenium, the same way we have alerts for mobile or handheld devices.

With handheld devices we have 2 types of alerts

  • Native app alerts
  • Mobile browser alerts

Let’s understand how each alerts are different and how to handle them using appium

Native app alerts:

Alerts for android apps (.apk) are part of the application but not system alert, and can be identified as usual by using UiAutomatorViewer tool (with appium locators).

Observe below screenshot and get the locator details for the “I agree” and “No, no”


Let’s implement the appium test on the app alert..

Browser alerts:

Alerts from browser actions, like confirmation/warning alerts while

  • submitting registration pages
  • navigating away from browser while payment is in progress.. etc

These types of alerts can’t be identified by uiautomatorviewer tool, we have to switch to alert and act on them like we did with desktop browser alerts. read handling browser alerts in selenium


Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

2 Responses

  1. Niraj Gahukar says:

    How to handle pop-up windows of the native app. e.g. in the selendroid app there is a button of display popup window. Tapping on which a popup appears. So how to handle that particular popup? Please help.

    • sunilpatro1985 says:

      Did u try identifying the popup, most of the time u should be able to identify as shown in the above screenshot of post.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: