'Actions Selenium Java mouse action drag and drop not working when cursor type changes after clickandhold
Actions Selenium Java mouse action drag and drop not working when cursor type changes after clickandhold
Use case:
- Mouse cursor type: Pointer
- Move to source element.
- click and hold with mouse cursor type: changing to a rectangle block.
- Move to target element and release.
Start Code snippet:
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
builder.moveToElement(fromWebElement).clickAndHold().moveToElement(toWebElement).perform();
Thread.sleep(2000);
builder.moveToElement(toWebElement).release().build().perform();
or:
builder.moveToElement(fromWebElement).dragAndDrop(fromWebElement,toWebElement).clickAndHold().build().perform();
end Code snippet:
The Above 2 code versions do not work fully. The mouse pointer moves to the source element and clicks on draggable element as I notice the cursor type change to rectangle block to confirm click and hold. But the action of moving to the target element with a draggable element does not happen. If I manually move the mouse the cursor type changes back to the pointer and I see the pointer move to the target element without the draggable element.
Solution 1:[1]
Unfortunately, Drag & Drop is currently not working.
For more information see the issue w3c/webdriver#1488.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mime |