4

I have a page that makes use of jQuery Drag & Drop, and I would like to build a relatively robust test suite for this process using Selenium.

Looking into Selenium, I've found that it has a Drag & Drop command on a jQuery plugin like: FullCalendar, but when I use the Selenium IDE to try to record 'dragging and dropping I don't get any recorded events.

So should I try to target the events using jQuery selectors?

Because the following don't work (targeting the '12p Lunch' on the example page)

<tr>
    <td>dragAndDrop</td>
    <td>/html/body/div[2]/div/div/div[2]/div/div/div/div/div[8]/div</td>
    <td>+100,+100</td>
</tr>

or even clicking on the element

<tr>
    <td>click</td>
    <td>/html/body/div[2]/div/div/div[2]/div/div/div/div/div[8]/div</td>
    <td>+100,+100</td>
</tr>

In both cases the XPath isn't found. So how can I target this changing element? If I had a unique id in the selector could I target that? Either way the drag&drop doesn't seem to be working:

<tr>
    <td>dragAndDrop</td>
    <td>id=targetelement</td>
    <td>+100,+100</td>
</tr>

Also can I target elements in the 'Location' with jQuery?

<tr>
    <td>dragAndDrop</td>
    <td>selenium.getuserwindow.browserbot.jQuery('#targetelement')</td>
    <td>+100,0</td>
</tr>
chim
  • 8,407
  • 3
  • 52
  • 60
jordan.baucke
  • 4,308
  • 10
  • 54
  • 77

1 Answers1

4

This works for me...

<!--test sorting-->
<!--move block 2 to col 1-->
<tr>
    <td>mouseDownAt</td>
    <td>//div[@id="block-set-col-1"]/ul/li</td>
    <td>80,20</td>
</tr>
<tr>
    <td>mouseMoveAt</td>
    <td>//div[@id="block-set-col-0"]/ul</td>
    <td>50,10</td>
</tr>
<tr>
    <td>mouseOver</td>
    <td>//div[@id="block-set-col-0"]/ul</td>
    <td>50,10</td>
</tr>
<tr>
    <td>pause</td>
    <td>2000</td>
    <td></td>
</tr>
<tr>
    <td>mouseUpAt</td>
    <td>//div[@id="block-set-col-0"]/ul</td>
    <td>50,10</td>
</tr>
chim
  • 8,407
  • 3
  • 52
  • 60
  • are you working with the example page that I referenced? I can't find the id's you referenced - are you adding them to the page? – jordan.baucke Oct 19 '11 at 22:51
  • No this is a test that worked for me in a different project, it demonstrates the process – chim Oct 20 '11 at 12:39