New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dragAndDrop NOT working on Chrome #4353
Comments
Please mention your protractor and Chrome/Firefox version? |
@zac11 Let me please know if you need some more info. |
Hi @dhawanaseem I wonder if this is an issue of protractor. If it is really an issue I would think it's more a webdriver / chromedriver thing. But having said that, I'm working with the following configuration Protractor: 5.1.2 I have created 2 testcases on 2 different sites. 1 site works and 1 doesn't In my opinion this is not an issue but more like a app thing that a Protractor / Chrome thing describe('Drag and drop with chrome', () => {
it('test-case 1: should drag and drop element', () => {
browser.get('http://codef0rmer.github.io/angular-dragdrop/#!/');
const drag = element(by.model('list1'));
const drop = element(by.model('list2'));
browser.actions().dragAndDrop(drag, drop).perform();
// Added it to be verify it by eye
browser.sleep(5000)
});
it('test-case 2: should not drag and drop', () => {
browser.get('http://marceljuenemann.github.io/angular-drag-and-drop-lists/demo/#/simple');
const drag = $$('.panel-body').get(0).all(by.repeater('item in list')).get(0);
const drop = $$('.panel-body').get(1);
browser.actions().dragAndDrop(drag, drop).perform();
// Added it to be verify it by eye
browser.sleep(5000)
});
}); |
@wswebcreation Thank you for the feedback. I have also put this issue on SO: It was suggested that this page contains and HTML5 Drag and Drop that is not supported by Selenium. Do you think you can shed more light based on the discussion there? |
I'll try to. Are you also convinced that that the problem is not with protractor? If so, can you please close the issue? |
@wswebcreation I do not know where the problem lies and I am also not getting any definitive answer. If I close this issue here, the issue does not get resolved and I do not know where else to seek a solution to this. |
Based in your SO post, the comments and some searching on the internet it looks like your app is using a HTML5 drag and drop which is not supported by Selenium. The library I mentioned in my comment above has a closed ticket that refers to it. See here I think you can close the issue now. |
@wswebcreation I have seen the solution that you are referring to. Can you kindly point out to me why -> Code for “jquery_load_helper.js” and the code above this script is the same. I do not understand how is the implementation supposed to be done because it not clear what is supposed to be referenced. Both the scripts: 1) jquery_load_helper.js is & 2) drag_and_drop_helper.js are being referenced in jquery_load_helper.js and the Code above (which should ideally be the implementation for dragNdrop). If you look closely, when both these files are referenced their path is different. Perhaps you can suggest what is the exact method. Thank you. |
Hi @dhawanaseem I don't think that this is the right place for these kind of questions. Please close this one |
I am still looking for help for Protractor with Typescript to implement this DragNDrop. The solution offered is for Python with Selenium Webdriver. |
And this is not the medium to look for that answer. The issuelist is only for issues related to Protractor. From the the getting help section of the README:
Thanks! |
Thank you! |
I'm also having some trouble with this and StackOverflow has no answers.
The item I'm dragging is stuck to the mouse but never dropped. |
After spending some time on this, it seems the only viable solution is using the html-dnd library const dnd = require('html-dnd').code;
const dragAndDrop = (elem, target) => {
let e1 = element(by.css(elem));
let e2 = element(by.css(target));
browser.executeScript(dnd, e1.getWebElement(), e2.getWebElement());
}
// usage
dragAndDrop('.dragThis', '.dropHere'); |
I am trying to perform a Drag and Drop operation on our Angular application using Protractor Jasmine. I am able to get hold of the source item but as the test runs, the source element gets selected but nothing happens thereafter; the drag and drop operation does not take place. There are no errors shown in the console.
An interesting thing about the destination container is that the items dropped here can be resized as per user wish. Also, there is no clearly marked place/area in the destination container where the dragged item will get dropped! But the container does have an ID; though that has still not helped here.
Here is the code:
let dragAndDrop = require('html-dnd').code;
.
.
.
function dragAndDropListItems(fdIndex: number): void {
let dragElement = element.all(by.repeater('listDefinition in lists')).get(fdIndex); // Select the first repeater corresponding to the first List Item in the list
};
I have tried using coordinate based DragNDrop operation as well but the same in every case.
Other tried options include:
// browser.driver.actions().mouseDown(dragElement).mouseMove(finalDrop).mouseUp(finalDrop).perform();
The text was updated successfully, but these errors were encountered: