Element should have been "select" but was "android.widget.CheckedTextView"

I am trying to select an option from a dropdown using Select but getting the below error. Please help.


Select Prod = new Select(driver.findElementsById(“android:id/text1”).get(2));
Prod.selectByValue(“Domestic parcels”);

Error Logs:
Exception in thread “main” org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been “select” but was “android.widget.CheckedTextView”
Build info: version: ‘3.4.0’, revision: ‘unknown’, time: ‘unknown’

Select class is used in Selenium only for the element which html have the tag Select. We can not used Select class in Appium.
In Appium u need to first click on the drop down and then separately click on the particular option which u want to select.

Thanks sachin,.
In my scenario what I want to do using appium is, get the options in the drop down and play around with them like printing, looping for further combinations down in the hierarchy where few more fields display based on this drop down selection and go on like submitting the form kind of.

Hope my query is clear.

In that case what u can do, u can create xpath of each above drop down on the bases of the displayed label like ‘Product category’, ‘Product or service’ etc. Which act like the parent locator for the respective drop down.

When the options open, then i think all options have same id or className. So we can use driver.findElements(Option_Locator) and then iterate each of it element to get the option text or perform the specific action on it.

May be this video would be workaround : https://youtu.be/0-zNUBLt45s