Am using the above code but it's not working."s2id_customFilter" is the id of the drop down.Am clicking on the id and sending keys but there's no action from selenium.

My code:

jQueryWebElement filterElement = selenium.jQuery("#s2id_customFilter");
JOptionPane.showMessageDialog(null, "one");
  • 2
    Probably depends on where the focus is. If you put a call to Click() first, to make sure focus is on the drop-down list, does that make a difference? Jun 20, 2013 at 15:32
  • I agree with @vincebowdren . It sounds to me like a focus issue as well.
    – djangofan
    Jun 20, 2013 at 19:59
  • @vincebowdren ... No difference it's still not working.Yes i have mentioned a click() before the above code to click on drop-down.
    – kittudk
    Jun 21, 2013 at 8:06
  • 2
    @selenium_vtiger If that's the solution you used to get the job done, perhaps you could craft a small post describing that, and then accept it as your solution? That'd be greatly appreciated!
    – corsiKa
    Mar 13, 2014 at 18:16
  • 1
    Ive got the same issue and reported here github.com/angular/protractor/issues/1622. Dec 11, 2014 at 22:27

4 Answers 4


I really like the answer from the link Philip Beadle posted in a comment:

It's a bad idea to test the core browser's behaviour as it's not your logic, i.e. you should not need to test that arrow keys work with options since that's something your browser implements.

And some Protractor (JavaScript) examples how to handle the drop from the same link:

var options = element(by.id('s2id_customFilter'));

And another one when the text changes a lot or is dynamic:

var optionsElements = element(by.id('s2id_customFilter')).all(by.tagName('option'));
    optionsElements.count().then(function(count) {
      console.log('I have ' + count + ' options')
    optionsElements.get(1).click(); // click on 2nd option

You should be able to do something similar in Java.


I think you need to move cursor first. Did you try to use moveToElement(WebElement toElement) before clicking on it? This link may be helpful.


May wish to try the following (C# Selenium Dev Studio 2015 environment)

There is a drop down item on the page labelled Contact Person, I used firebug inside of Mozilla FireFox to get the absolute XPATH of this drop down item as depicted below

public static readonly string ContactPerson_DD_AXPATH = 

Then in my C# code to cause a down arrow and enter keys functions on the drop down I code:

IWebElement contactName = driver.FindElement(By.XPath(ContactPerson_DD_AXPATH));


I learned somewhere that sending an Escape may help some tough key sequence actions from time to time.


For any rubyists, I've found 'pick first option in the dropdown' a powerful way to avoid data combinatorial testing through the UI, once you create unit and integrated tests that do that testing and explain that to the business.

As a method, e.g. selecting the first school from a test field dropdown

def select_first_school select_id
  find_by_id(select_id).send_keys :arrow_down
  find_by_id(select_id).send_keys :tab

Your Answer

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

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