I am new to Selenium, currently am working on selenium webdriver. I want to select a value from the drop-down. But I am not able to do it because of some error. Also, I want to inform you that in my automator viewer I have not found any id of the dropdown element hence I am using with XPath but I am not able to do please guide me. My java code is below:

public void print() throws Exception


    WebDriverWait wait = new WebDriverWait(driver, 60);// 1 minute


    Select drpCountry = new Select(driver.findElement(By.xpath("//android.widget.ImageView[@index='2']")));



enter image description here

1 Answer 1


It seems that your Select element is one level above the thing you are capturing, try using xpath of the View above your ImageView

  • Hi @Moro , I have try as you said but got no any solution :( Dec 2, 2019 at 13:02
  • Hey @Moro , Please guide me further what should i have to do i am stuck on it. Dec 6, 2019 at 9:05
  • Have you tried simply clicking the desired Element from the list? I do not use appium, so despite the fact that you are capturing wrong element for a Select list I am not sure I can be of any help.
    – Moro
    Dec 6, 2019 at 10:11
  • Yes sir, i have tried not working but its ok. and Thanks for your valuable response :) Dec 6, 2019 at 10:44
  • Hi @Moro, can you please someone tag this issue to help me. I am totally stuck on it. Jan 17, 2020 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.