Cant access drowpdown/spinner item

Hi, im currently working on a project (android native) that requires a dropdown to select a customer id type.

The dropdown items are according to the sourcecode:

public void setOptions(@NonNull List<SelectableOption<T>> options) {
    this.options = options;
    List<String> strOpts = options.stream()
            .map(opt -> getContext().getString(opt.getStringResource()))
            .collect(Collectors.toList());
    autoCompleteTextView.setAdapter(new ArrayAdapter<>(getContext(), R.layout.dropdown_item, strOpts));

And the layout:
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android=“http://schemas.android.com/apk/res/android
android:id="@android:id/text1"
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:padding=“16dp”
android:ellipsize=“end”
android:maxLines=“1”
android:textAppearance="?attr/textAppearanceSubtitle1"
/>

The issue is that even with the id assigned (android:id/text1) i cant find it using appium via appium desktop or with code(python) or with android monitor/uiautomatorviewer

I have tried:

  • driver.find_element_by_id(“android:id/text1”)
  • driver.find_element_by_android_uiautomator(‘new UiScrollable(new UiSelector()).scrollIntoView(" + “new UiSelector().text(”" + CUIL + “”));"’)
  • driver.find_element_by_android_uiautomator(‘new UiSelector().text("" + CUIL + “”));’)
  • xpath with //*[contains(@text, ‘CUIL’)]

Any ideas? Or there is anything that the dev team can change so it appears on the app source/hierarchy?

Thanks

can you see it in ‘Layout Inspector’ of Android studio?

layout_inspector

Apparently the items are wraped in a PopUpWindow and not as a child of the spinner (they are using https://material.io/components/text-fields/android#using-text-fields)

try add to capability:

capabilities.setCapability("enableMultiWindows", true);

it should work with all windows.

1 Like

So, if i use “enableMultiWindows” on appium desktop, i CAN access the id “android:id/text1” of the dropdown items although this issue appears https://github.com/appium/appium-desktop/issues/1529

I still cant access with python but ill continue trying.

Thanks for the tip!