0

Android Inspector:

This is image of android inspector

Unable to identify elements in Appium inspector instead of one element whole panel type of area is selecting when I click on the menu I want to select an element from that menu which comes from left to right.

Please help me so that I can find a single element's xpath right now the whole panel is getting selected in appium inspector.

enter image description here

This is on android.

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Gerry
  • 11
  • 1

1 Answers1

0

Unfortunately it's not behaviour you can change in the Appium Inspector.

That doesn't mean it stops you from identifying elements. You can click on the XML tree and open and look manually for your elements. If you found the right element in the tree, then you can check out the properties and work out the right XPath.

After that you can test the XPath by using the selector tester in the top menu of the Inspector.

New edit:
Automating between Native and WebView can be read here on appium.io. The elements you find in the inspector are probably in the WebView and you must switch to this in order for Appium to reach the correct elements.

Step 1: Print out all possible views through - this way you can retrieve what views there are and switch between them if you are in the app. Within hybrid apps, there are different views and you need to enter the correct one first in order to automate elements.

Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
    System.out.println(contextNames); //prints out something like NATIVE_APP \n WEBVIEW_1
}
driver.context(contextNames.toArray()[INDEX]);

Step 2: Print the page source to get a scope of all elements in the currenct view through driver.getPageSource(). If you do this for all views you can see the possibilities and elements you have.

kenneth
  • 478
  • 4
  • 11
  • Actually when I am selecting xml tree manually that also no element get selected. only three – Gerry Nov 17 '22 at 10:08
  • Hello Kenneth I tried to see it in xml but it is showing only three panel header footer and middle panel. Please help. Can you see my screen once you are free. – Gerry Nov 17 '22 at 10:28
  • Ah I see now you are with an app that has a WebView. Can you try and click each of the WebView elements in the XML tree and see if you can switch from Native to WebView in Inspector? WebView is a container in Appium which the Native Inspector doesn't show directly. – kenneth Nov 17 '22 at 10:36
  • can we please talk at harrypjohn@gmail.com? its really urgent I am not able to understand your comment. – Gerry Nov 20 '22 at 18:00
  • Please help I really need help. – Gerry Nov 27 '22 at 10:49
  • @Gerry I've add some extra information in my answer. Try and print the page source between all possible views when you start the app through Appium. – kenneth Nov 28 '22 at 11:31