dragAndDropToObject (drop from, drop to) - Selenium IDE command

dragAndDropToObject: Here you provide element locator of object to be dragged in target column and element locator of drag destination object in value column. Do not confuse this with the "dragAndDrop" command (not supported, does anyone need it?) where you need to provide source element locator in target column and x,y offset in pixel (Current location to destination location where you want to drop element) in value column with "dragAndDrop" command.

Drag and drop recording is tricky. The command works well for simple cases like https://html5demos.com/drag/, but the IDE can not yet record pages like https://jqueryui.com/draggable/ because there is no drop target and it depends on x,y coordinates. For widgets like https://fritz-c.github.io/react-sortable-tree/ it fails because it seems to depend on dragover/enter to show the final drop target. Of course, we would be more than happy to receive pull requests if you can improve drag and drop further.

Overall, visual web automation is better suited for drag & drop testing than the Selenium DOM based approach. The free Kantu visual automation tool controls the mouse inside the Chromium and generates all the right mouse events by design.

dragAndDropToObject Example

Command Target Pattern/Text
open https://html5demos.com/drag/
dragAndDropToObject id=one id=bin
dragAndDropToObject id=two id=bin

Works in

Kantu for Chrome Selenium IDE, Firefox IDE Classic

Related Demo Macros

Demo-Autofill, Demo-Frame

The ready-to-import-and-run source code of all demo macros can be found in the Github repository testmacros folder.

See also

storeEval, Web Automation Extension User Manual, Selenium IDE commands, Classic Firefox Selenium IDE.

Anything wrong or missing on this page? Suggestions?

...then please contact us.

Kantu Selenium IDE for Chrome and Firefox - Web Test Automation
Subscribe to the a9t9 automation software newsletter . We'll send you updates on new releases that we're working on.