Testing jQuery Drag & Drop and Droppable with Selenium

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

Looking at Selenium, I found that it has a Drag and Drop command on the jQuery plugin, for example: FullCalendar , but when I use the Selenium IDE to try and write down drag and drop. I do not receive any recorded events.

So should I try to target events using jQuery selectors?

Because the following does not work (targeting "12p Lunch" per 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 by clicking an item

 <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, XPath was not found. So how can I target this changing item? If I had a unique identifier in the selector, could I target? In any case, drag & drop does not work:

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

Is it also possible to customize items in "Location" using jQuery?

 <tr> <td>dragAndDrop</td> <td>selenium.getuserwindow.browserbot.jQuery('#targetelement')</td> <td>+100,0</td> </tr> 
+4
source share
1 answer

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> 
+4
source

Source: https://habr.com/ru/post/925886/


All Articles