I'm trying to doubleclick on an option within a selectbox using the Actions class in c# Selenium WebDriver. The following code works fine for firefox but not for IE or Chrome. Any suggestions on why or how I might investigate whats going wrong?
var sideBarAgentList = new SelectElement(driver.FindElement(By.CssSelector("#agentSelectBox")));
var agentInList = sideBarAgentList.Options.First(o => o.Text == "Agent49159 - 49159");
new Actions(driver).DoubleClick(agentInList).Perform();
The HTML is
<select id="agentSelectBox" ondblclick="javascript:addAgentDesktop(this.selectedIndex);" onchange="javascript:showAgentInfo(this.selectedIndex);" style="width:220px;background:#e0e0e0;font-family:Verdana;font-size:75%;" size="22">
<option value="0" style="background:white;color:blue">
Agent49159 - 49159
</option>
</select>
From what I can tell the doubleclick action does not work in IE or Chrome on an option in a select element. I have updated my code to click the option from the select menu, then doubleclick the select element itself rather than the option. Works for FF, IE and Chrome.
new SelectElement(driver.FindElement(By.CssSelector("#agentSelectBox"))).Options.First(o => o.Text == "Agent49159 - 49159").Click();;
new Actions(driver).DoubleClick(driver.FindElement(By.CssSelector("#agentSelectBox"))).Perform();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With