我正在尝试应用拖放功能,它既不会给我带来错误,也无法正常工作。框的XPath(我需要拖放)是正确的,我可以单击它。请建议 enter image description here
答案 0 :(得分:0)
首先,您的问题没有HTML,我给出的答案是通用的
public static void main(String[] args) throws Exception {
driver.get(URL you want to hit);
//Element which needs to drag.
WebElement FromElem=driver.findElement("Locator"));
//Element on which need to drop.
WebElement ToElem=driver.findElement("Locator"));
//Using Action class for drag and drop.
Actions act=new Actions(driver);
//Dragged and dropped.
act.dragAndDrop(FromElem, ToElem).build().perform();
}