Showing posts with label Drag and Drop. Show all posts
Showing posts with label Drag and Drop. Show all posts

Monday, June 2, 2014

Drag and Drop or how to use dragAndDrop() method.

import java.util.concurrent.TimeUnit;

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 Dropdrag {
    public static void main(String[] args) {
        WebDriver driver = new FirefoxDriver();
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        driver.get("http://yuiblog.com/sandbox/yui/3.2.0pr1/examples/dd/groups-drag_clean.html");
        Actions act = new Actions(driver);
        WebElement source1 = driver.findElement(By.id("pt1"));
        WebElement target1 = driver.findElement(By.id("t2"));
        act.dragAndDrop(source1,target1).perform();
       
       
    }

}