For automating the the android app created by using ionic( version 1.7.15 ) in the uiautomaterviewer of android tools,
Problem Statement
I’m in need of resource-id to do the automation testing.I’m hereby comparing the my app with pacifica for the proper understanding of my exact problem.
Expected Result
The app of pacifica developed in ionic(version unknown),installed in SAMSUNG galaxy J2 and automated in uiautomaterviewer,The resourced id is available
First of all, is there any resolution for this yet?
I am also not able to fetch any IDs set or even content description.
I have set them as following: <ion-button resource-id="buttonLogin" shape="round" (click)="validateData()" aria-label="Login Button">Login</ion-button>
Here aria-label is for Content Description and resource-id is for ID.
Is there any other way of doing it? (I am new to ionic so these things are confusing as of now)
I was running into the same issue and finally discovered it has been working the entire time, but the default UI Automator view does not allow you to see what you actually set.
Using Ionic elements, you are effectively wrapping the native HTML elements with ionic, ion-input wraps input. So when you place the ID on the ion-input to set the resource ID:
<ion-input id="userName">
the resource ID is on the wrapped parent, not the child. This is important as, from my experience, you are not able to see the Ionic parent in UI Automator viewer.
I was only able to see this when I used Appium’s integrations of UI Automator viewer. It showed the ionic parent in the snapshot and allowed me to access it. Fortunately, you can still access the child uniquely from the parent’s resource ID. There is only ever one child on the parent for inputs or buttons, so you just select the first child of the parent with the resource-id you need.