UIAutomatorViewer is a tool to inspect and identify UI elements in Android apps. However not every UI element you see is accessible to UIAutomatorViewer. Sigh. I know. That sucks. But at the very least, UIAutomatorViewer lets you know which of these elements are not accessible.
I was messing around with Appium and DroidFish secretly hoping to write an automated test that would play out a famous chess game. I noticed that I was able to identify the chessboard but not the individual squares. Most parts of the app were identifiable using UIAutomatorViewer. For example, the buttons are easily identifiable in the UIAutomatorViewer as shown in the image below:
The chess board however is slightly different. In the UIAutomatorViewer you can see that NAF is set to true in the Node Details.
What is NAF ?
NAF means Not Accessible to Framework and only limited information may be available for these components. So if you want to automate a workflow involving a NAF element – well, good luck! I hope you have good relations with the developer and can request them to make a change to the application.
As a workaround, I decided to move the chess pieces by using the co-ordinates. This is not recommended. The co-ordinates will change for each device you test on. Do not use this approach unless you have no other option.
NOTE: I have reported the same on appium-discuss with the hopes that there is a better solution.
© 2013-2018, Vrushali Toshniwal. All rights reserved.