This is how i evaluate customised XPaths for Appium code.

Gulshan Nadaph
2 min readSep 7, 2020

--

Prerequisites

Install uiautomatorviewer2.

Install adb

Install any app on a mobile device or emulator.

  1. Connect device to your computer or start emulator on which you would like to take the XPath from.
  2. Open uiautomatorviewer2, click on the save icon on top left as shown below:

This step will save a file of .uix format for that screen.

3. Navigate to any online XPath evaluator like https://www.freeformatter.com/xpath-tester.html

4. Select choose file >> browse to the saved .uix file.

In the XPath expression field, write the XPath you want to validate.

If a match is found, the matched result will be displayed in the XPath result or it shows NO MATCH!..

You can try other combinations to find a customised xpath.

Quick note while forming XPaths :

Relative layout is where the positions of the children can be described in relation to each other or to the parent.

Linear layout arranges other views either horizontally in a single column or vertically in a single row.

--

--

No responses yet