Is it possible to simulate drag and drop in casperjs and phantomjs like in selenium?
Asked Answered
B

1

6

I am trying to simulate a Drag & Drop event that is done using JQuery in my site. Manually performing the "drag & drop" with my own JQuery "works", but after the form where the drag & drop event is located is submitted, nothing will happen because there are event-listeners attached to the mouse drag and drop events, and these listeners don't get triggered by my "manual" movements. I am looking for something similar to Testing jQuery Drag & Drop and Droppable with Selenium.

This is a sample of the code that works only visually, but doesn't trigger the drag&drop event handlers:

// "Simulate" drag&drop
casper.evaluate(function() {
  det = jQuery("table#draggableview_secondary_touts_block_order_1 tbody tr").last().detach();
  jQuery("table#draggableview_secondary_touts_block_order_1 tbody").prepend(det);
  jQuery("form#draggableviews-view-draggabletable-form-secondary-touts-block-order-homepage").submit();
});
Benetta answered 21/9, 2012 at 0:36 Comment(0)
P
0

You could fire the events directly, as show here: https://ghostinspector.com/blog/simulate-drag-and-drop-javascript-casperjs/

does that suite your purposes, or do you need the events triggered on a higher level?

Prier answered 12/10, 2017 at 15:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.