I am trying to automate spicejet.com website, but the thing is I am not able to access the dropdown values using select as the dropdown values like destination, source etc are not in Select Option="value" format. When I try to work on using click and select the places it's not working as the click lands me in different page. and it's not only that, I have seen same pattern in many websites. using input field, buttons and lists instead of direct drop down lists.

  • 1
    Please show the exact HTML you are working with and also the code for the attempts you have made. Then we can advise better Apr 7, 2016 at 11:11
  • What client for webdriver do you use? python/java/js? Apr 7, 2016 at 16:32

3 Answers 3



I have face this issue. Its really weird when all automation scripts and code written as per standards but ultimately it get failed. Below solution works for me:

Step 1.

WebElement listbox_webelement = drive.findElement(By.xpath("write_your_xpath_of_element"));


listbox_webelement.click() [ Expected to list get visible ]


Select select = new Select(listbox_webelement);




  • TrueAlpha - Your issue resolved or still facing it? Aug 8, 2016 at 5:55

You are using Select class to manipulate an ul element (unordered list) and it will fail, as Select class was designed to cater select (i.e dropdowns) elements only.

Now to solve your problem statement, say I have to select Kochi(COK) from the list, follow the below steps :

  1. Do a sendkeys.


  2. Now perform a click using linktext.

    driver.findElement(By.linkText("Kochi (COK)")).click();

Hope this helps.


As a matter of fact for drop down list, in Selenium we have Select class. To use this select class you have to use import statement-

import org.openqa.selenium.support.ui.Select

This Select class has several methods that are supported to access the elements.

  • ByVisibleText
  • ByIndex
  • By.Id
  • ByValue

Sample code:

Select dropDown1 = new Select(element1);            

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.