【发布时间】:2017-04-24 04:35:33
【问题描述】:
我想要做的是将左侧边栏中的一个元素拖到中心区域,如图所示。但不起作用,虽然没有出现错误消息。
image of the page
我的代码是:
//drag and drop - not working
WebElement element = driver.findElement(By.xpath("//*[@id='componentsSection']/div[1]/div[1]"));
Thread.sleep(1000);
WebElement target = driver.findElement(By.id("layoutSection"));
Thread.sleep(1000);
(new Actions(driver)).dragAndDrop(element, target).build().perform();
提前致谢!
【问题讨论】:
-
您也可以尝试以下操作:
-
试试我的答案,并在
from和toweb-element 中正确替换您的xpath。
标签: java selenium drag-and-drop webdriver