RE: How to simulate the Drag and Drop on this page

1 Answers

Hi dvenugopalrao,

For Drag and Drop you need to use Actions class.

In your above code you are inspecting the correct element. Next thing you need to inspect the element where you need to drop the element which is the “sortable2”.

And now you just need to use the dragAndDrop method of Actions class.



WebElement sortable1 = driver.findElement(By.xpath(".//*[@id='sortable1']/li[1]"));
WebElement sortable2 = driver.findElement(By.xpath(".//*[@id='sortable2']"));
Actions builder = new Actions(driver);

builder.dragAndDrop(sortable1, sortable2).perform();

Supporter Answered on December 26, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.