Protractor. How to do a drag and drop action?

回眸只為那壹抹淺笑 提交于 2019-12-08 08:32:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!