I am trying to perform a drag and drop action in an angular app with HTML 5 canvas. The method dragAndDrop in protractor doesn't work on it . Although it works on jQuery Draggable interface.
I tried doing it in by calculating window size but it still doesn't work
var w = 0;
var h = 0;
browser.executeScript(function () {
var width = $(window).width();
var height = $(window).height();
return { width: width, height: height };
}).then(function (size) {
w = size.width;
h = size.height;
console.log('***1**** width + height *********' + w + ' + ' + h);
browser.wait(protractor.ExpectedConditions.invisibilityOf(element(by.className('bodyLoader'))), sync.maxTimeToLook);
var control = element(by.xpath(labelLocator));
browser.actions().dragAndDrop(
control, { x:w/2, y: h/2 }
).perform();
});
I searched around and found this issue https://github.com/SeleniumHQ/selenium-google-code-issue-archive/issues/3604
I've tried many solutions and many helper functions like:
https://gist.github.com/SirLenz0rlot/cc5baa5a73f188f62f6f
https://gist.github.com/druska/624501b7209a74040175
There is currently an issue posted here.