Search code examples
appium

How to use Appium to select the elements from a searchview dropdownlist?


As you can see in this picture, I can't locate the Id or XPath of the details I want to click. I'm using AndroidDriver.

enter image description here

I had tried the following codes:

            AndroidElement searchView = androidDriver.FindElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"Tribology Testing\"));");

but I still can't get the Tribology Testing being select.


Solution

  • We cannot help you to come up with the correct element locator without seeing your application layout, screenshot doesn't help at all.

    You can see the layout by invoking AndroidDriver.getPageSource() function - it will print all the UI hierarchy of the current screen and you will be able to create the corresponding selector.

    Another options are:

    1. Android Device Monitor (part of Android SDK)

      enter image description here

    2. Layout Inspector (part of Android Studio)

      enter image description here

    3. XPath Feature of the Appium Studio

      enter image description here