0

我需要使用 angula6 元素的 selenium webdriver 将元素从一个位置拖到另一个位置

我试过使用

动作动作 = 新动作(驱动程序);act.dragAndDrop(from, to).build().perform();

但它不起作用。

import org.openqa.selenium.interactions.Actions;

String obj = "/html[1]/body[1]/app-root[1]/app-frame[1]/div[1]/adsvalu-create-sales-target[1]/section[1]/div[1]/div[1]/section[1]/div[1]/div[2]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]";
String obj1 = "/html[1]/body[1]/app-root[1]/app-frame[1]/div[1]/adsvalu-create-sales-target[1]/section[1]/div[1]/div[1]/section[1]/div[1]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[1]";

WebElement from = driver.findElement(By.xpath(obj));
WebElement to = driver.findElement(By.xpath(obj1));
Actions act = new Actions(driver);
act.dragAndDrop(from, to).build().perform();

没有错误,但没有发生拖放操作

4

0 回答 0