Skip to content

How to Automate Drag and Drop in Selenium and Playwright

Practice drag-and-drop automation — simple drop zones, sortable lists, kanban column transfers, type-restricted zones, and multi-column boards in Playwright, Selenium & Cypress.

Advanced20 min6 scenarios14 test cases

Interactive Scenarios

S01Scenario 1: Drag Item to Drop Zone (Beginner)

Drag the item into the drop zone.

Drop here
Item not dropped yet
S02Scenario 2: Drag to Correct Labelled Zone (Medium)

Drag each card to its matching zone. Cards show which zone they belong to.

Alpha
zone-a
Beta
zone-b
Gamma
zone-c
Zone ADrop here
Zone BDrop here
Zone CDrop here
No card dropped
S03Scenario 3: Reorder a Sortable List (Medium)

Drag items to reorder the list. Each item has data-item-id — use it as the locator anchor.

  • Playwright
  • Cypress
  • Selenium
  • WebdriverIO
  • Puppeteer
List not reordered
S04Scenario 4: Kanban Column Transfer (Hard)

Column headings have no data-testid. Scope via data-column-id then find data-task-id.

Todo3

Write login tests
Automate checkout flow
Set up CI pipeline

Done1

Refactor page objects
No task moved
S05Scenario 5: Type-Restricted Drop Zones (Hard)HARD

Zones only accept their matching shape type. Rejection feedback has no data-testid — locate via role="status".

Circle
Square
Triangle
Circle onlyDrop here
Square onlyDrop here
Triangle onlyDrop here
No drop attempted
S06Scenario 6: Multi-Column Board (Challenge)CHALLENGE

Some cards have no data-testid. Find them via aria-label or getByRole('article',{ name: /Fix login/ }) .

Backlog
Write API tests
Fix login bug
In Progress
Refactor selectors
Review PR #42
Done
Deploy to staging
Board untouched