Skip to content
CodeKruPro

Using Select on a dropdown built from divs (Java)

QuizMediumJava onlyAsked in: Accenture, Infosys, TCS

The country dropdown is built from <div> and <li> elements, not a <select>. What does new Select(driver.findElement(By.id("country"))) do?

  • It throws UnexpectedTagNameException, because Select works only on select elements
  • It works the same as on a select element
  • It returns a Select with no options
  • It throws NoSuchElementException

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in