问题
I need the element id for my appium - android automation testing. When I use real device with UIAUTOMATOR, I get the resource - id to interact with the element like :
driver.findElementById("com.xyz.android:id/GSG");
However, when I use an emulator with my UIAUTOMATOR , there is no resource - id for the same elements and my script is also not able to interact with the element based on my real device id...any help as to how to fix this or why it behaves like this?
回答1:
I found the answer using different versions of android devices - the explanation is android 4.3 has the id component in uiautomatorviewer. Android versions less than API level 18 will not be able to interact with the resource-id of the element.
来源:https://stackoverflow.com/questions/21399503/real-device-vs-emulator-uiautomator-does-not-show-resource-id-for-the-app