Not able to clicking on a popup from another app (Play Store)

I am implementing payment test automation for my Android app. The purchase is handled by the Play Store itself.

When I click on a ‘Purchase Credits’-Button inside my app a popup from the Play Store appears:

(just ignore the error message - I am using a dev version not supposed to be sold in the store)

Now I am not able to reach any element inside the popup with Appium. Trying to click on the green OK-button produces

`org.openqa.selenium.NoSuchElementException: Can’t locate an element by this strategy: Locator map:

  • native content: “By.id: continue_button” `

Just to be sure the test waits about 5 seconds for the popup to become fully visible. Nonetheless when calling driver.getPageSource() I just seem to get the view hierarchy of the underling app, but not the popup itself.

At the same time the popup is perfectly visible and reachable inside both the uiautomator as well as the Appium Inspector.

The app is an native app. The test implementation is in Java.

Any ideas as to how to solve this issues will be much appreciated.

If you try to get all buttons available on native context, asking for class android.widget.button, do this button appears in the list?

If does, once you identify the button in tthe buttons list, you could just click in this specific button element.

No buttons are found when I let the driver find all elements of the class android.widget.Button. To be sure there was no mistake I also confirmed with the Appium inspector that this is the class of the button inside the popup (buttons inside my app use different classes).

It seams as if the driver focus does not change to the popup but stays with the app in the background instead.

I probably have found the reason for this behaviour: the driver capability AUTOMATION_NAME is set to ‘selendroid’. Changing it to ‘appium’ should fix the problem.

1 Like