我正在使用 selenium webdriver,我试图在其中拖放表格的一列。但是,一旦我拖放列,我就会收到错误消息“元素不再附加到 DOM”。下面是我用于拖放元素的代码
WebElement draggable = objectIdentifierType(
objectIdentificationKeyword, objectValue);
WebElement droppable = GetBrowserDriver.driver.findElement(By.xpath(objectData));
/*WebElement droppable = objectIdentifierType(
objectIdentificationKeyword, objectValue);*/
if (draggable != null) {
System.out.println(draggable.getText()+"Draged element");
System.out.println(droppable.getText()+"Droped element");
//System.out.println(droppable.getText());
new Actions(GetBrowserDriver.driver).dragAndDrop(
draggable,droppable).build()
.perform();
HTMLReport.bw.write("<script type='text/javascript'>addDetailRow('"
+ GenericFunctions.testCaseName + "','"
+ HTMLReport.testcaseTABLESNO() + "','\""
+ "Drag Value: "
+ draggable.getText()
+ "','Drop Value \""
+ droppable.getText()
+ "\" ','"
+ "','Passed' )</script>");
// new
// Actions(GetBrowserDriver.driver).dragAndDrop(draggable,
// droppable);
String actualResult = "The Slider value is changed to the expected value.";
CreateExcel updatePassed = new CreateExcel();
updatePassed.updatePassedTestSteps(actualResult,
expectedResult, objectData);