I have written below code to drag an element and add it in workspace. There is no error in console window however drap drop is not performed on chrome browser.
WebElement dragElement = driver.findElement(By.xpath("//*[@id='sidebar-wrapper']/div/div/nginclude/div[2]/accordion/div/div[1]/div[2]/div/div/div[1]/div[2]"));
Thread.sleep(4000);
System.out.println("Element Selected to Drag");
WebElement dropElement = driver.findElement(By.xpath("//*[@id='workspace']/div/div/div/div[2]/div/div/div/div[2]/span"));
Thread.sleep(4000);
act.clickAndHold(dragElement).moveToElement(dropElement).release().build().perform();
I have tried multiple times but not able to succeed. Please provide your inputs
Copyright Notice:Content Author:「Shivani Thaman」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/39221848/drag-and-drop-functionality-not-working-properly-in-selenium-webdriver-for-chrom