dragAndDropToObject - Selenium IDE
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.
Alternative: XMove Drag & Drop
In general visual task and test automation is better suited for drag & drop testing than the HTML DOM based approach. It always works! Visual drag & drop automation can be used in the browser and on desktop. It uses real mouse events.
Drag and Drop with XMove. For details see this forum post: Drag & Drop with RPA software
dragAndDropToObject Example
Command | Target | Pattern/Text |
---|---|---|
open | https://ui.vision/demo/webtest/dragdrop/ | |
dragAndDropToObject | id=one | id=bin |
dragAndDropToObject | id=two | id=bin |
Works in
Ui.Vision RPA for Chrome Selenium IDE, Ui.Vision RPA for Firefox Selenium IDE, Firefox IDE Classic
Related Demo Macros
DemoDragDrop
The ready-to-import-and-run source code of all demo macros can be found in the Open-Source RPA software Github repository.
See also
execute Script, Web Automation Extension User Manual, Selenium IDE commands, Classic Firefox Selenium IDE.
Anything wrong or missing on this page? Suggestions?
...then please contact us.