我无法跨框架将元素(图像)从源拖动到目标。我尝试在Ubuntu,Chrome 41和Windows Chrome 41以及Firefox 36上使用Webdriver(selenium 2.45.0)。两个WebElements都可以独立成功定位,因此它不是定位器问题。我的代码:
Actions builder = new Actions(driver);
builder.clickAndHold(recipeImage);
Action action = builder.build();
action.perform();
driver.switchTo().frame(driver.findElement(By.xpath("//iframe[contains(@id,'contentPane_view-')]")));
builder = new Actions(driver);
builder.moveToElement(imageField);
builder.build();
builder.release(imageField);
action = builder.build();
action.perform();