Note that there are some explanatory texts on larger screens.

plurals
  1. POSelenium2's Select object not firing onchange event in IE8
    text
    copied!<p>In my app I have two <code>&lt;select&gt;</code> tags. The first one changes the options inside the second one and enables it in the onchange event. </p> <p>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).</p> <pre><code>Select select = new Select(getElementByName(name)); element.selectByValue(value); </code></pre> <p>The first <code>&lt;select&gt;</code> changes as expected. However, the second <code>&lt;select&gt;</code> remains empty and disabled. I tried this as a workaround:</p> <pre><code>if(ie) { WebElement select = getElementByName(name); WebElement option = select.findElement(By.cssSelector("[value='"+value+"']")); List&lt;WebElement&gt; 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 &lt; options.size() &amp;&amp; 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 } </code></pre> <p>but now I get inconsistent results. The desired <code>&lt;option&gt;</code> always gets selected, while only sometimes does the event get fired.</p> <p>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?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload