-> go to url -> create action class -> web element source -> web element destination -> perform action (click and hold source -> move to destination element -> release the element)
----
public class DragAndDrop
{
public static void main (String []arg) throws Exception
{
String url = "
https://softwaretestingboard.com/q2a/1/how-to-drag-element-using-selenium#axzz5eTh5jQe0";
String un ="Admin";
String pw = "admin@";
System.setProperty("webdriver.gecko.driver", "D:\\Soft\\geckodriver.exe");
WebDriver driver =new FirefoxDriver();
driver.navigate().to(url);
Thread.sleep(5000);
Actions ActionDrageAndDrop = new Actions (driver);
WebElement Source = driver.findElement(By.xpath("/html/body/div[1]/div[2]/ul/a"));
WebElement Destination = driver.findElement(By.xpath("/html/body/div[1]/div[2]/ul/a"));
ActionDrageAndDrop.clickAndHold(Source).build().perform();
ActionDrageAndDrop.moveToElement(Destination).build().perform();
ActionDrageAndDrop.release(Destination).build().perform();
/* also try with direct method dragAndDrop
ActionDrageAndDrop.dragAndDrop(Source, Destination).build().perform();
*/
}
}