Wednesday, 8 February, 2017 UTC


Summary

Hello!
We’ve been seeing a lot of talk from users on Appium regarding the changes that have come out of the Appium 1.6.0 release. One of the biggest changes are the Appium inspector missing with Appium.
We’ve done a lot of research and we wanted to provide you the options that are available to work around this issue. 
One of the tools that’s available that we use internally here on projects is Macaca.
Macaca was developed to run Appium with multiple selenium session in a single test. But there’s a very special tool within it that was updated to support the new instrumentation from Apple XCUITests.
The tool also has the ability to pull Xpath values for Android as well! #Winning
To install this tool you can follow the instructions on the repository in the link  or you can follow them below!
**These instructions are under the assumption you have Appium installed locally already and Homebrew**
  1. Open up Terminal and run “ npm install macaca-cli -g
  2. After install is complete, verify it was installed correctly, run “ macaca doctor
    1. If the error shows: “Command Line Tools: ios_webkit_debug_proxy is uninstalled”
    2. Run, ” brew install ios-webkit-debug-proxy
    3. Then Run “ macaca doctor
    4. Everything should be green
  3.  When you have confirmed the installation was correct you should see
  4. Next, run ” npm install app-inspector -g ” 
  5. After install is complete you should see that the words “BUILD SUCCESSFUL” in the logs.
  6.  Launch a simulator and grab the DEVICE_ID or UUID of the simulator.
    1. To get the DEVICE_ID/UUID for iOS, run the following
    2.  ” xcrun simctl list “
    3. Find the device name of the simulator which shows booted like below: 
    4. To use an android device or simulator, run the following
      1. “adb devices”
  7.  Copy the UUID and then run,” app-inspector -u YOUR-DEVICE-ID* Make sure simulator is booted first before running*
  8. When the process is finished, it will load a new window with the view hierarchy loaded and BRAVO! you now have a app inspector. We’re not done yet though!
  9. ** For iOS** Next we need to load the app we want to inspect to the device.
    1. You can launch the simulator from Xcode and deploy the app, *** If you deploy the app this way after starting the app inspector server you will have to kill the server and relaunch after the app has been deployed OR
    2. You can install it if you have a .app file already built locally
      1.  Run ” xcrun simctl install YOUR-DEVICE-ID ~/PATH-TO-.APP/
    3. Launch the application you installed to simulator
  10. For Android you can load any application via adb
    1. adb install example.apk
    2. For simulator ” adb install -s example.apk
  11. Now you if you go back to the page that loaded the view hierarchy, hit refresh and the app view will load.
  12.  If you click on a element in the view, it will highlight where that element corresponds to in the view like below: 
OR You can select the element from the tree and it will highlight it on the view.
On the right hand side you will see that it will also include the Xpath
 ex: “//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeTabBar[1]/XCUIElementTypeButton[4]
That’s it! 
Now you can use the tool to view and identify elements in the view hierarchy.
Let’s us know in the comments of any other tools or if you have a different method we would love to hear it!