Drag & Drop with Selenium

Using Selenium for web-gui tests is really nice. You can record your workflow with the excelent selenium plugin for firefox and use them to write your own test.
The only problem seems to be Drag&Drop. The senenium runner has some drag&drop methods, but they don’t seem to work in any way. But selenium offeres mouse controll where you can simulate mouse clicks not only at an absolute position, but rather relative to a dom object. So, if your dragable <div> element has ID1 and the dropzone has ID2 you could write the following in your testrunner:


The important command for this is probably the mouseOver one, without that the richfaces d&d component for JSF would not work.

This entry was posted in java, Testing and tagged , , . Bookmark the permalink.

One Response to Drag & Drop with Selenium

  1. Pingback: Test Driven Development | Pearltrees

Leave a Reply