drag and drop using selenium webdriver

package SeleniumWebDriver;

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;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;

public class DraganddropCircle {
    WebDriver driver;
    
     @Test
      public void draganddropCircle() throws Exception {
          
          driver.get("http://www.seleniumlearn.com/drag-and-drop");
         driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
          Thread.sleep(9000);
          Actions act=new Actions(driver);
          WebElement source=driver.findElement(By.id("draggable"));
          WebElement target=driver.findElement(By.id("droptarget"));
          act.dragAndDrop(source,target).perform();
          
      }
  @BeforeTest
  public void beforeTest() {
      driver=new FirefoxDriver();
      driver.manage().window().maximize();
  }

  @AfterTest
  public void afterTest() {
  }

}

Tags: