简体   繁体   中英

Selenium webdriver (java): Drag And Drop issue

Application : Adobe CQ5 - Author Instance

Task : Drag an image from the content-dam and drop in the image dialogue of CQ5

Language used : Java + Selenium WebDriver 2.40

I am trying to perform the drag and drop operation to achieve the above task. The issue here is that the source and destination are on two different panes (Source image in the content Dam, and destination is a html dialogue box)

Problem faced:

  1. Clicking and holding image - Works fine
  2. Moving to the destination - Works fine
  3. Releasing the image on the destination - FAILS

在此处输入图片说明 <>

The destination element is displayed and available (when checked from debugger) I've tried to switch to Active element/default content The destination is not on any frame/iframe

This worked few days back (older version of Selenium 2.36 Version). But now it fails with the latest version (and old version as well)

Am i missing anything here.? I was not able to figure out why webdriver is not releasing the image from control on the destination.

Thanks in advance.

I also had this problem before. I am using version 2.42.2 What I did is switching to the Iframe before release it. This is the snippet

WebElement sourceElement = mySourceElement;
Actions builder = new Actions(driver);
Action dragAndDrop = builder.clickAndHold(sourceElement).build();
dragAndDrop.perform();
driver.switchTo().frame(iFrame);
WebElement targetElement = myTargetElement;
Thread.sleep(1000);
dragAndDrop = builder.moveToElement(targetElement).release().build();
   dragAndDrop.perform();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM