Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium WebDriver不适用于Html5拖放_Html_Drag And Drop_Webdriver - Fatal编程技术网

Selenium WebDriver不适用于Html5拖放

Selenium WebDriver不适用于Html5拖放,html,drag-and-drop,webdriver,Html,Drag And Drop,Webdriver,下面是我正在使用的代码,它将访问一个使用Html5编写的公共网站,该代码试图将“一”拖到垃圾桶,但它什么也不做。有什么办法可以让它工作吗?提前谢谢 FirefoxProfile profile = new FirefoxProfile(); profile.setEnableNativeEvents(true); WebDriver driver = new FirefoxDriver(profile); driver.get("http://html5demos

下面是我正在使用的代码,它将访问一个使用Html5编写的公共网站,该代码试图将“一”拖到垃圾桶,但它什么也不做。有什么办法可以让它工作吗?提前谢谢

    FirefoxProfile profile = new FirefoxProfile();
    profile.setEnableNativeEvents(true);
    WebDriver driver = new FirefoxDriver(profile);
    driver.get("http://html5demos.com/drag");

    WebElement draggable = driver.findElement(By.id("one"));
    WebElement droppable = driver.findElement(By.id("bin"));

    new Actions(driver).dragAndDrop(draggable, droppable).build().perform();
其他资料如下:

Selenium版本:2.25.0 苹果操作系统狮子 浏览器:Firefox
浏览器版本:10.0.2和14.0.1

我敢说这是某种兼容性问题。我在上使用了以下代码

它在IE9上就像一个符咒。然而,它不能与我的Firefox 14一起工作,这可能是“新的”


您还可以使用JavaScriptExecutor尝试一些解决方法,这里描述了类似的内容:

我们看到的是与晶晶发布的完全相同的问题。对于这一点,Selenium是否存在开放性缺陷。同样的代码在InternetExplorerDriver上运行良好,但在Firefox驱动程序上不起作用。经过对SO和网络的广泛研究,我认为这是一个硒缺陷。我在这里提交了一份bug报告:可能是
System.setProperty("webdriver.ie.driver","C:\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
driver.get("http://jqueryui.com/demos/draggable/");
WebElement draggable = driver.findElement(By.id("draggable"));
new Actions(driver).dragAndDropBy(draggable, 200, 10).build().perform();