This test opens a page with draggable and droppable elements. It drags one element onto another using Actions API. Then it prints the text of the target to confirm the drop.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class ComplexGestureExample {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();
driver.get("https://example.com/dragdrop");
WebElement source = driver.findElement(By.id("draggable"));
WebElement target = driver.findElement(By.id("droppable"));
Actions actions = new Actions(driver);
actions.dragAndDrop(source, target).perform();
String text = target.getText();
System.out.println("After drag and drop, target text: " + text);
driver.quit();
}
}