Selenium Drag and Drop Operation

Selenium Drag and Drop Operation



The inbuilt dragAndDrop function provided by selenium RC classes will do the expected operation well easily. Some times its difficult to do drag and drop operations like drop on particular element, etc. Here is the approach.


1. Drag an element to drop on to another element:
  1. driver.get("myURL");
  2. var from = driver.findElement(By.xpath("fromElement"));
  3. var to = driver.findElement(By.xpath("toElement"));
  4. new Actions(driver).dragAndDrop(from, to).build().perform();

2. Drag an element to an offset:
  1. driver.get("myURL");
  2. var dragElement = browser.findElement(By.id("ElementToDrag"));
  3. new Actions(driver).dragAndDropBy(dragElement , 20010).build().perform();




go to link download

Popular posts from this blog

DroidJack RAT Androrat Android Sample

Modern Combat 2 Black Pegasus apk data Free Download

Notepad 6 6 8