Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Drag and Drop through Web Driver

    • 0
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 326
    Comment on it

    here is the method for doing drag and drop operation on mozilla

    1. Create Driver for any Browser(Mozilla)
    2. Go to the URL
    3. Create an Action object for Driver
    4. Fetch and create WebElement object for the SOURCE element.
    5. Fetch and create WebElement object for the DESTINATION element.
      6.Perform ACTION.
      a.Click and Hold the source WebElement.
      b.Move to destination WebElement.
      c.Release the Element.

    Here is the code for handling drag and drop operation through web driver

    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.evontech.com/examples/dragdrop/");
    driver.manage().timeouts().implicitlyWait(3,TimeUnit.MINUTES);
    
    Actions act = new Actions(driver);
    WebElement src = driver.findElement(By.xpath("//div[@id='items']/div[1]"));
    WebElement des = driver.findElement(By.id("trash"));
    
    act.clickAndHold(src).build().perform(); 
    act.moveToElement(des).build().perform();
    act.release(des).build().perform();

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: