Hi Guys
Anyone still has issue of drag and drop item in Chrome. I have problem with it always. There was another thread that introduced the way using web driver actions. It did not work for me. I could see the test passed without error, all steps were performed, But the actual drag and drop activities were not happening. Following is the code:
WebDriver driver = desktop.<BrowserApplication>find("//BrowserApplication").getWebDriver();
WebElement dragSource = driver.findElement(By.xpath("(//div[starts-with(text(),\" CAN 0.500 02/01/201\")])[3]"));
WebElement dropDest = driver.findElement(By.xpath("(//span[text()=\"Drag a security\"])[3]"));
Actions builder= new Actions(driver);
Action dragAndDrop = builder.clickAndHold(dragSource)
.moveToElement(dropDest)
.release(dropDest)
.build();
dragAndDrop.perform();
I also tried following walk-around. Did not work too. Same story again. Performed all the steps without error, but did not actually take the action.
Rectobj = desktop.<DomElement>find("//BrowserApplication//BrowserWindow//DIV[@textContents='CAN 0.500 02/01/2019'][3]").getRect(true);
desktop.pressMouse(MouseButton.LEFT, obj.getCenter());
Rect box = desktop.<DomElement>find("//BrowserApplication//BrowserWindow//SPAN[@textContents='Drag a security'][3]").getRect(true);
desktop.mouseMove(box.getCenter());
desktop.releaseMouse(MouseButton.LEFT, box.getCenter());
Appreciate if anyone has any other idea?
Thanks
Jian