seleniumboot / seleniumboot/selenium-boot
Locator.dragTo(Locator) for HTML5 drag-and-drop
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12
- Forks
- 6
- Avg merge
- 5h 48m
- Merged PRs (30d)
- 18
Description
Problem
Locator (src/main/java/com/seleniumboot/locator/Locator.java) has a full set of terminal actions (click(), hover(), jsClick(), etc. at lines 222-305) but no drag-and-drop action — there is no dragAndDrop or dragTo anywhere in source. Raw Actions.dragAndDrop(...) (the obvious workaround) is well known to silently no-op against pages that implement HTML5 dragstart/dragover/drop handlers instead of relying on native OS-level drag events, because those handlers never fire from Selenium's native input synthesis on many browser/OS combinations.
Why it matters
Drag-and-drop widgets built on the native HTML5 DnD API (draggable="true" + dragstart/drop listeners) can't be exercised at all through the current API without a manual JS workaround.
Proposed API
// Locator.java, terminal actions section (near jsClick(), line ~285)
public void dragTo(Locator target) {
// 1. attempt native Actions.dragAndDrop(source, target)
// 2. if the target's DOM state shows no drop occurred, fall back to a
// synthetic DataTransfer JS dispatch (dragstart -> dragenter -> dragover -> drop -> dragend)
}
Follow resolve()'s convention for waiting/resolving both source and target elements before acting, and throw LocatorException (matching resolve()'s existing exception type) if either side can't be resolved.
Acceptance criteria
-
Locator.dragTo(Locator target)added - Native
Actions.dragAndDropattempted first - Synthetic
DataTransfer/JS event-dispatch fallback for HTML5dragstart/drophandlers when the native gesture produces no observable drop - Unit tests covering both the native path and the fallback path (mocked
WebDriver/JavascriptExecutor) - Javadoc with a usage example matching the style of the other terminal actions in this file
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/main/java/com/seleniumboot/locator/Locator.java, near the terminal actions at lines 222-305, and compare its element resolution with resolve(). Implement and verify the native and synthetic paths using mocked WebDriver/JavascriptExecutor tests, including unresolved source or target behavior. Done means dragTo(Locator) has matching Javadoc, attempts Actions.dragAndDrop first, falls back for HTML5 handlers, and covers both paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100