问题
I am currently writing a protractor test and I need to drag a drop some elements... Basically the other developers at the time used angular drag and drop to implement this functionality. I have been searching for a couple of hours but I haven't figured out yet how to get through it. This is the element I am trying to drag. Actually, there are 4 draggable elements and I want to drag the last one on the first one in order to make first the last one:
this.draggableFields = element.all(by.css('dnd-nodrag'));
I using the latest version of protractor and the latest version of webdriverJS as well. Thanks in advance for your time.
回答1:
Make a try of this one :
ptor.actions().dragAndDrop(
ptor.findElement(protractor.By.css('dnd-nodrag')).get(0);
ptor.findElement(protractor.By.css('dnd-nodrag')).get(1);
ptor.findElement(protractor.By.css('dnd-nodrag')).get(2);
ptor.findElement(protractor.By.css('dnd-nodrag')).get(3);
).perform();
来源:https://stackoverflow.com/questions/37280718/protractor-how-to-do-a-drag-and-drop-action