Hi everyone,
I am working on protractor typescript scripts. I am trying to automate drag and drop on a website but unable to do that.
What all I have tried:
let source=element(by.xpath(“abc”));
let destinaton=element(by.xpath(“xyz”));
- await browser.driver.actions().dragAndDrop(await source.getWebElement(),await destinaton.getWebElement()).perform();
- browser.actions().dragAndDrop(source,destination).perform();
- await browser.driver.actions().mouseMove(await source.getWebElement()).
mouseDown(await source.getWebElement()).
mouseMove(await destinaton.getWebElement()).
mouseUp(await destinaton.getWebElement()).
perform();- await browser.driver.actions()
.mouseMove({x: srcx, y: srcy})
.mouseDown()
.mouseMove({x: destx, y:desty})
.mouseUp().perform();- var fs = require(“fs”);
var dnd_js = fs.readFileSync("/abc/drag_and_drop_helper.js");
browser.driver.executeScript(dnd_js+source+".simulateDragDrop({ dropTarget: “+destination+”});")- var dragAndDrop = require(‘html-dnd’).code;
browser.driver.executeScript(dragAndDrop, source, destination);
All the approaches mentioned above I have tried, and many more approaches but nothing is working. It is only hovering on source and destination element but dragging is not happening.
Technologies used:
Typescript : 3.0.1
protractor : 7.0.0
Please help me if there is any working work around.