鼠标clickAndHold()在Firefox上使用Selenium Webdriver无法正常工作 [英] Mouse clickAndHold() not working properly on Firefox Using Selenium Webdriver
问题描述
我正在使用Selenium Webdriver客户端2.39和Firefox 26.
I am using selenium webdriver client 2.39 and Firefox 26.
鼠标单击并按住事件无法正常工作.我的代码就像
Mouse click and hold event does not work properly. My code is like
WebDriver driver=new FirefoxDriver();
driver.get("http://startingwithseleniumwebdriver.blogspot.com/2013/12/frmset1.html");
WebElement multiSelectDropDown=driver.findElement(By.name("multiselectdropdown"));
List<WebElement> dropdownlists = multiSelectDropDown.findElements(By.tagName("option"));
Actions builder=new Actions(driver);
builder.clickAndHold(dropdownlists.get(0)).
clickAndHold(dropdownlists.get(6)).click().build();
此代码不会产生任何错误,只能选择一个元素. 我可以使用其他方式绕过此问题,但我想知道它不起作用.
This code does not give any error but select only one element. I can bypass this issue using other way but I want to know whay it is not working.
推荐答案
我遇到了同样的问题,但是它从头到尾选择了元素,并给出了一些错误,例如
I face the same problem but it select the element from start to last and give some Error like
无法执行本地交互:无法获取元素的节点-无法交互
Cannot perform native interaction: Could not get node for element - cannot interact
我通过这种方式获得了解决方案,您可以针对您的问题进行解决
I got the solution by this way you can do this for your problem
builder.clickAndHold(dropdownlists.get(0)).moveToElement(dropdownlists.get(6)).release().build().perform();
这篇关于鼠标clickAndHold()在Firefox上使用Selenium Webdriver无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!