Gerry
Gerry

Reputation: 11

Android Unable to identify elements in Appium inspector instead of one element whole panel type of area is selecting

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.

Upvotes: 0

Views: 1605

Answers (1)

kenneth
kenneth

Reputation: 728

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.

Upvotes: 0

Related Questions