Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6885545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:38:53+00:00 2026-05-27T05:38:53+00:00

In my app I have two <select> tags. The first one changes the options

  • 0

In my app I have two <select> tags. The first one changes the options inside the second one and enables it in the onchange event.

When I use the Select object provided by Selenium2 it doesn’t fire that event when running in IE8 (works great in FF and when I do it manually).

Select select = new Select(getElementByName(name));
element.selectByValue(value);

The first <select> changes as expected. However, the second <select> remains empty and disabled. I tried this as a workaround:

if(ie) {
    WebElement select = getElementByName(name);
    WebElement option = select.findElement(By.cssSelector("[value='"+value+"']"));

    List<WebElement> options = select.findElements(By.cssSelector("option"));
    //select the first element
    options.get(0).click();

    //make sure the select is focused
    select.click(); //open
    select.click(); //close

    Keyboard keyboard = getWebDriver().getKeyboard();
    for(int i = 0; i < options.size() && option.getAttribute("selected") == null; i++) {
         keyboard.pressKey(Keys.DOWN);
         //note: if i do a Thread.sleep(100); here, it works more consistently, but still not 100%
    }
} else {
     // Do the above snippet
}

but now I get inconsistent results. The desired <option> always gets selected, while only sometimes does the event get fired.

Obviously the best option is getting the Select to work in IE8. Has anyone else seen this issue? Seems like a bug in Selenium2. Is there a known workaround for this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:38:54+00:00Added an answer on May 27, 2026 at 5:38 am

    After talking with some of the Selenium folk in the #selenium IRC chat room I settled on this fix:

    WebElement selectElement = getElementByName(name);
    Select select = new Select(selectElement);
    element.selectByValue(value);
    if(usingIE) {
        webDriver.executeScript("$(arguments[0]).fireEvent('change');", selectElement);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to have two app.config files where one app.config serves as a
I have two Activities in my App, one is a ListView which displays a
I have two different layouts in my app, one for javascript (AJAX) requests and
I have two forms in my rails app. They both exist in separate tabs
I have two UITextFields in the App as IBOutlets and I have made a
I have two buttons in my flex app next to each other, ButtonA and
I have two domains declared in my app. class Posts { String title String
I have two sprites in my app. Both should have touches enabled and both
I have two screens on my app that I want to present to users,
So I have two sortable lists in a web app I'm writing. What I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.