-1

I am working with a production APK of my customer, and I'm trying through Appium inspector to get interface elements to be able to find it in my JUnit test. There is some way to inspect those elements?

Thank you

Appium inspector result

For privacy reasons, I have hidden the preview screen

Reza Mousavi
  • 4,420
  • 5
  • 31
  • 48
Santi
  • 130
  • 1
  • 6
  • Check if you have set capabilities.setCapability And use 'appPackage' and 'appActivity' to specify what package and activity to launch. Appium won't recognise 'LaunchActivity' – Krishnaraj Rajendran Nair Oct 11 '18 at 09:04
  • Hello, the capabilities are well implemented, but Appium inspector is not able to catch the screen elements (Tags, properties and tag content). My knowledge about React Native is low, could it be the compilation process? Thank you – Santi Oct 11 '18 at 14:50
  • Have u tried with UIAutomator viewer,you can refer https://automationlab0000.wordpress.com/2018/08/14/uiautomatiorviewer/ – pankaj mishra Oct 11 '18 at 15:01

1 Answers1

1

You should be able to locate elements on Android using UIAutomatorViewer.

The uiautomatorviewer tool provides a convenient visual interface to inspect the layout hierarchy and view the properties of UI components that are visible on the foreground of the device. This information lets you create more fine-grained tests using UI Automator. For example, you can create a UI selector that matches a specific visible property.

To launch the uiautomatorviewer tool:

  • Launch the target app on a physical device.
  • Connect the device to your development machine.
  • Open a terminal window and navigate to the /tools/ directory.
  • Run the tool with this command: $uiautomatorviewer

You can find more information HERE

Currently there is a lack of classes due to an issue with React Native 0.57 and higher, I registered it here: Issue on GitHub

You either need to: add 'testID' for iOS or 'accessibilityLabel' for Android to see 'content-desc' attribute. This is currently the only type of element recognision you can add that will be visible for Appium. You can also try and use the Android UiSelector with 'MobileBy.AndroidUIAutomator'

ABorkowski
  • 36
  • 5
  • Hello, thank you for sharing that tool, I have tried it and got results which showing elements, however that elements have empty properties except app package, the properties resource-id, class, text... are empty. Then I researched about react native dev-tool [link](https://facebook.github.io/react-native/docs/debugging) , but need implement to the project code, I have only project APK. Thank you – Santi Oct 15 '18 at 10:23
  • 1
    @Santi The lack of classes is due to an issue with React Native 0.57 and higher, I registered it here: [Issue on GitHub](https://github.com/facebook/react-native/issues/21238) The tool you're looking at will not help you find resource-id's, content-descs or anything. You either need to: add 'testID' for iOS or 'accessibilityLabel' for Android to see 'content-desc' attribute. This is currently the only type of element recognision you can add that will be visible for Appium. You can also try and use the Android UiSelector with 'MobileBy.AndroidUIAutomator' – ABorkowski Oct 16 '18 at 10:00
  • Thank ABorkowski! I will follow your Issue on GitHub. Your answer as a result has been very usefull. – Santi Oct 17 '18 at 07:00