Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.
selenium.getDriver().findElement(By.id("s2id_customFilter")).sendKeys(Keys.ARROW_DOWN);

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"); selenium.jQuery(".select2-choice",filterElement).click(); JOptionPane.showMessageDialog(null, "one"); selenium.getDriver().findElement(By.id("s2id_customFilter")).sendKeys(Keys.ARROW‌​_DOWN);

share|improve this question
1  
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? –  vincebowdren Jun 20 '13 at 15:32
    
I agree with @vincebowdren . It sounds to me like a focus issue as well. –  djangofan Jun 20 '13 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. –  selenium_vtiger Jun 21 '13 at 8:06
    
@user5492 Can you show some more of your webdriver code, and screenshots of the control you're trying to interact with? –  vincebowdren Jun 21 '13 at 8:09
    
jQueryWebElement filterElement = selenium.jQuery("#s2id_customFilter"); selenium.jQuery(".select2-choice",filterElement).click(); JOptionPane.showMessageDialog(null, "one"); selenium.getDriver().findElement(By.id("s2id_customFilter")).sendKeys(Keys.ARROW‌​_DOWN); –  selenium_vtiger Jun 21 '13 at 12:36
show 1 more comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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