seleniumboot / seleniumboot/selenium-boot

Locator.dragTo(Locator) for HTML5 drag-and-drop

Open
#50 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
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.dragAndDrop attempted first
  • Synthetic DataTransfer/JS event-dispatch fallback for HTML5 dragstart/drop handlers 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.