Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Drag and Drop is not working on custom drag objects #4420

Closed
lukeis opened this issue Mar 4, 2016 · 6 comments
Closed

Drag and Drop is not working on custom drag objects #4420

lukeis opened this issue Mar 4, 2016 · 6 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 4420

I was trying to test methods to drag object across a frame when I ran into this.

baseUrl: http://www.ankur.com/

Steps: Try to drag Dra1 on to Dro1. Use the selenium code below 

driver.get(baseUrl + "projects/FrameGlider/demo/simple/a.html");
         driver.switchTo().frame("b");

Actions builder = new Actions(driver);

Actions draganddrop = builder.clickAndHold(driver.findElement(By.id("Dra1"))).moveToElement(driver.findElement(By.id("Dro1"))).release(driver.findElement(By.id("Dro1")));

draganddrop.perform();

Now I under stand that there might be challenges (explanations against) DnD across
frames. But in the script above, DnD within a frame is not working.

Reported by shukl.prashant on 2012-08-15 00:01:46

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hi!

Could you provide more details on issue?
version of selenium, which driver is used etc?

At my configuration (Vista+IE9+selenium2.25+iedriver) drag&drop of Dra1 and Dro1 items
from the same frame is worked. Example python script is attached.

Also imho it's possible to use drag&drop for items in different frames - try to use
move with offset instead of moving to element with offset values as summarized relative
coordinates of frame elements and target element.

Reported by a.u.savchuk on 2012-08-18 02:06:46


- _Attachment: [test.py](https://storage.googleapis.com/google-code-attachments/selenium/issue-4420/comment-1/test.py)_

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2012-09-11 11:13:20

  • Status changed: NeedsClarification
  • Labels added: Component-WebDriver

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

No responce from the author for a long time, closing the issue.

Reported by barancev on 2012-10-10 10:39:05

  • Status changed: Invalid
  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I've reopened this defect in http://code.google.com/p/selenium/issues/detail?id=4815

Reported by vova.prisyazhnuk on 2012-11-26 09:47:32

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hi all,
The drag and drop operation workfine with the following code. I just ensure that I
should not use stale element and that pay me off good with expected result.
WebDriver driver = new FirefoxDriver();
    driver.get("http://www.ankur.com/projects/FrameGlider/demo/simple/a.html");
    driver.switchTo().frame("b");
    WebElement source = driver.findElement(By.id("Dra1"));
    WebElement target = driver.findElement(By.id("Dro1"));
    Actions builder = new Actions(driver);
    //builder.clickAndHold(source).build().perform();
    //System.out.println(source.getLocation());
    //System.out.println(target.getLocation());
    driver.switchTo().frame("c");

    WebElement cSource = driver.findElement(By.id("Dra2"));
    WebElement cTarget = driver.findElement(By.id("Dro2"));
    builder.clickAndHold(cSource).build().perform();
    System.out.println(cSource.getLocation());
    System.out.println(cTarget.getLocation());
    driver.switchTo().defaultContent();
    driver.switchTo().frame("b");
    System.out.println(source.getLocation());
    driver.switchTo().frame("d");


    WebElement dSource = driver.findElement(By.id("Dra3"));
    WebElement dTarget = driver.findElement(By.id("Dro3"));
    builder.moveToElement(dTarget, 5, 5).click(dTarget).build().perform();
    System.out.println(dSource.getLocation());
    System.out.println(dTarget.getLocation());

Thanks,
Sai Pradeep.

Reported by manju271989 on 2013-10-03 07:31:57

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:16:01

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant