Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I drag and drop an object from one grid to another in the same page using Selenium IDE. This is a web page, and it is designed in ExtJS. Please help me out doing this using the IDE.

share|improve this question

In Selenium IDE there are 2 main drag and drop commands;

(1) dragAndDrop - Locates the target element and drags the element by x pixels horizontally and y pixels vertically.

In the IDE this should look like;

Command - dragAndDrop
Target - [ locator of the target element ]
Value - [ (x-pixels),(y-pixels) ]
    - where x-pixels/y-pixels can be negative (left/up respectively) or positive (right/down respectively)

(2) dragAndDropToObject - Locates the target element and drags the element to the centre pixel location of the destination element

In the IDE this should look like;

Command - dragAndDropToObject
Target - [ locator of the target element ]
Value - [ locator of the destination element you want to drop it on top of ]

The other drag and drop commands impose the -AndWait suffix, so assume that in response to the drag and drop done a request is sent and selenium should wait for the page to reload.

share|improve this answer

Our pages are programmed with extJS too and I managed to drag and drop elements with the following steps:

  • mouseOver
  • mouseDownAt
  • MouseMoveAt
  • MouseUpAt

But for me it is just possible if the element is visible at loading of the element. When I have to scroll to the element to get it visible, I did not find a way to drag 'n drop it.

share|improve this answer

The functions (APIs) available in selenium for drag and drop do not work properly. So my suggestion for the drag and drop, can be resolved by the below code:

selenium.mouseDown(fromLocator, "0,0");
selenium.mouseMove(toLocator, "0,0");
selenium.mouseUp(toLocator, "0,0");

Please try and let us post your observation.

share|improve this answer

For "dragAndDropToObject":

If you want to drag "A" and drop to Location of "B"

Command: dragAndDropToObject Target: enter the Xpath or CSS path of A value: enter the Xpath or CSS path of B

Hope it helps.

share|improve this answer
How is this a different (or more informative) answer than pmafi's answer below? – Suchit Parikh Oct 1 '12 at 22:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.