我们遇到硒中的doubleClick无法正常工作的问题。
我们正在使用Actions执行doubleClick,如下所示:Selenium webdriver Java code using web driver for double click a record in a grid。
经过调查和多次尝试后,我们发现它与doubleClick 的速度有关。如您所知,speed of doubleClick可能会发生变化。有没有选择在selenium中设置doubleClick的速度?
用于执行双击的代码:
public WindowControl(ref YourNewClassWithSettings test)
{
// example: You can now say TextBox1.Text = test.StringNumber1;
// Whatever you change here like test.
test.StringNumber1 = "IamDone";
//When you close this window, because test was passed by ref : you
// will see StringNumber1 = "IamDone" in your main window again
//when accessing the property of that class. Always pass by ref
this.Close();
}
我们尝试没有' build'太:
Actions actions = new Actions(webDriver);
actions.doubleClick(element).build().perform();
答案 0 :(得分:0)
似乎您在应用程序中使用自定义时序进行双击,我建议尝试使用2次单独的点击,并在相同的自定义时间之间等待。我认为这是两次点击之间控制时间的最简单方法。
答案 1 :(得分:0)
Alternative workaround described here
简化回答(更改为所需元素):
((JavascriptExecutor) driver).executeScript("document.getElementById('map_container').dispatchEvent(new Event('dblclick'));");