Unable to inspect PICKER/DROPDOWN on Appium Inspector(Android)

Hi,

Device: Android

App: react native hybrid app

Appium/Appium Inspector version: Version 1.15.1 (1.15.1.20191013.2)

Issue:

I am unable to inspect a picker/dropdown. It doesn’t appear in the app source at all. Hence unable to find any locators to do further automation.

Steps:

  • I open the android app on the mobile and navigate to a form where certain details need to be filled.

  • One of the things to be filled is a dropdown.

  • I click on the arrow on the dropdown field

  • A NEW window/popup appears on top of the ORIGINAL form for the picker values to be displayed, which can be scrolled to see various values.

  • This new picker value window/pop up doesnt not come in the app source in the appium inspector at all

Can you please tell me a workaround to automate this scenario to select values in the dropdown.I am using Java + Selenium + Appium for the automation framework.

Thank you!

did you try switch to webView?

Hi,
Thanks for your reply.
However, my app only has Native_APP context. Uploaded appium log screenshot.

Its just a picker value, something similar like this screenshot.

Any ideas that you suggest?

This is iOS not Android. At least looks like more iOS…

I just took a sample screenshot from google. I couldn’t find anything more similar to my situation
But this is how it looks on my ANDROID app. If it makes any sense.
Thanks

can you share result of System.out.println(driver.getPageSource()); on this screen at https://gist.github.com/ ?

Thank you for your reply.
I have messaged you the gist link .

is it suggestion dropdown? e.g. when you enter address. it is not visible indeed.
as workaround i did for it:

  • enter more precise address
  • tap by X,Y by taking input field element coordinates and a bit below.

another workaround you can try is:

  • enter search text
  • then navigate to choose some text like:
((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.DPAD_DOWN));
((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.ENTER));

Thanks for the suggestions.

No, its not a suggestion dropdown. Its just like how I have shown in screenshot above. we need to scroll to select the values.

I will try the pressKey workaround and update you.

Thanks!

The suggestion “((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.DPAD_DOWN));
((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.ENTER));” is not working.

Since its a fixed drop down , there is no keyboard or any text to be searched. We have to scroll the picker to select existing values.

Any reason why appium is unable to inspect these elements?
Is it because its a Native React application?

Appium (or better to say UiAutomator) can only inspect something that is exposed to the Accessibility layer. If the app does not expose views then these won’t be visible in UIA as well.

Are there any specific appium requirements for a react native app, for the elements to be visible in the XML source?

The picker does appear in screenshot in appium inspector, but not in the XML source section of Appium Inspector.

Consider switching to a web view context to interact with such apps

Hi,
Thanks for your reply.
However, my app only has Native_APP context. Uploaded appium log screenshot.

This does not mean there is no web context, but rather that it is not debuggable.

  1. I navigated to the screen where the picker is active
  2. Retrieved the currently available contexts using:
  3. The console output on the IDE is:
    image

Does this still mean that there is web context?
How can we switch to web context when we dont know the name of the context?

Thanks

  1. to print all available contexts:
driver.getContextHandles().forEach(context -> {
            System.out.println(context);
        });
  1. even if web context absent is still DOES NOT guarantee that it not exist in app. e.g. as mentioned mykola-mokhnach your webView maybe disabled for debug and thus not visible in any context. better double check with developer. But if you said “react native hybrid app” - it means webView must be here.

  2. it will be a bit help if you see your app page source with printing “driver.getPageSource()”.

Thank you for your suggestions. Will discuss with the devs.

I did have a look at Page Source. Had shared a gist link with you.

Thanks!