小编use*_*015的帖子

无法在 selenium webdriver c# 中双击

我正在尝试使用 c# Selenium WebDriver 中的 Actions 类双击选择框中的选项。以下代码适用于 Firefox,但不适用于 IE 或 Chrome。关于为什么或如何调查出了什么问题的任何建议?

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();
Run Code Online (Sandbox Code Playgroud)

HTML是

<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>
Run Code Online (Sandbox Code Playgroud)

c# selenium action double-click selenium-webdriver

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

action ×1

c# ×1

double-click ×1

selenium ×1

selenium-webdriver ×1