0
package Chrome_Packg;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;

public class testFirefox_DragDrop {

    public static void main(String[] args) throws InterruptedException {
        WebDriver driver=new FirefoxDriver();
        driver.get("http://jqueryui.com/droppable/");

        WebElement drag=driver.findElement(By.xpath("/html/body/div[1]"));//drag element
        WebElement drop=driver.findElement(By.xpath("/html/body/div[2]"));//drop element

        Actions action=new Actions(driver);
        Thread.sleep(3000);
        action.dragAndDrop(drag, drop).perform();


    }

}

After executing the code, using Run as java application, in output I am getting nothing.

Paolo Forgia
  • 6,572
  • 8
  • 46
  • 58
Samy
  • 73
  • 1
  • 11
  • For solution, please check out below --> [Solution](https://stackoverflow.com/questions/58960054/selenium-webdriver-unable-to-drag-and-drop-element-in-ie11/59168761#59168761) – atul parate Oct 24 '20 at 07:19

1 Answers1

0

Here is the code snippet for the same website that you are trying on and you can also find the example here selenium Drag and Drop example

driver = new FirefoxDriver();
    driver.manage().window().maximize();
    driver.navigate().to("http://jqueryui.com/droppable/");
    //Wait for the frame to be available and switch to it
    WebDriverWait wait = new WebDriverWait(driver, 5);
    wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector(".demo-frame")));
    WebElement Sourcelocator = driver.findElement(By.cssSelector(".ui-draggable"));
    WebElement Destinationlocator = driver.findElement(By.cssSelector(".ui-droppable"));
    dragAndDrop(Sourcelocator,Destinationlocator);
    String actualText=driver.findElement(By.cssSelector("#droppable>p")).getText();
    Assert.assertEquals(actualText, "Dropped!");
Dev Raj
  • 650
  • 2
  • 7
  • 18