|
http://www.w3school.com.cn/tiy/t.asp?f=html5_draganddrop
上面这个页面的拖拽,尝试了各种网上能找到的方法,都没拖拽成功。如:
driver.switchTo().frame("i");
WebElement source = driver.findElement(By.id("drag1"));
WebElement target = driver.findElement(By.id("div1"));
Actions action = new Actions(driver);
1、action.dragAndDropBy(source, 0, -60).build().perform();
2、action.dragAndDrop(source, target).build().perform();
3、action.dragAndDrop(source, target).perform();
4、action.clickAndHold(source).build().perform();
action.moveToElement(target);
action.release(source);
action.build().perform();
。。。求解。
PS:http://www.w3school.com.cn/tiy/t.asp?f=html5_draganddrop这个网页中用下面的方法拖拽就没有问题。。
WebElement frameElement = driver.findElement(By.className("demo-frame"));
driver.switchTo().frame(frameElement);
WebElement draggable = driver.findElement(By.id("draggable"));
new Actions(driver).dragAndDropBy(draggable, 200, 10).build().perform(); |
|