2

My company has a new application that incorporates drag and drop. The drag and drop is done via the Dragula library.

I'm trying to automate this functionality, but I'm not having any luck. I have tried both WebDriver's built in DragAndDrop() method (which my understanding is it doesn't normally work so well with modern web tech). I tried constructing my own Drag and Drop with Actions. And I've also tried using jquery in the javascript executor. Neither of these methods have worked.

Anyone have any suggestions?

Andrio
  • 1,852
  • 2
  • 25
  • 54
  • I found a work around here: https://github.com/bevacqua/angular-dragula/issues/86 However this doesn't work, since we cannot expose our Dragula method. – Andrio Jan 16 '17 at 15:50
  • 1
    What do you mean you cannot expost your Dragula Method? Kindly provide a [MCVE] – Jeremy Thompson Jan 16 '17 at 22:18
  • @JeremyThompson The Dragula object is created in a function. For that workaround to work, it would need to have a global scope. According to our developers, this is not doable. – Andrio Jan 19 '17 at 19:39
  • @Andrio did you find a work around for this? as I face similar issue please update with answer if you found any? – swathi Feb 09 '17 at 01:16
  • @swathi I'm sorry, I never did find a work around. We ended up deciding for the developers to implement a work around to dragging and dropping. – Andrio Feb 11 '17 at 01:43
  • @Andrio there is a workaround :) [here](https://stackoverflow.com/a/46434071/5831897) – Angel Fraga Parodi Sep 26 '17 at 19:15

1 Answers1

1

If DragAndDrop() method didn't work for you can build your own using other methods from Actions

IWebElement source;
IWebElement target;

Actions actions = new Actions(driver);
actions.ClickAndHold(source).Perform();
actions.MoveByOffset(target.Location.X - source.Location.X, target.Location.Y - source.Location.Y).Perform();
actions.Release(target).Perform();

This will scroll vertically and horizontally.

Guy
  • 46,488
  • 10
  • 44
  • 88