istacklongtime
istacklongtime

Reputation: 1

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:

  1. Mouse cursor type: Pointer
  2. Move to source element.
  3. click and hold with mouse cursor type: changing to a rectangle block.
  4. 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.

Upvotes: 0

Views: 791

Answers (1)

istacklongtime
istacklongtime

Reputation: 1

Unfortunately, Drag & Drop is currently not working.
For more information see the issue w3c/webdriver#1488.

Upvotes: 0

Related Questions