Drag and Drop
Command value: dragAndDrop
Drags an element and drops it onto another element.
Fields
| Field | JSON property | Description |
|---|---|---|
| Target | target | CSS selector or XPath of the element the step acts on, for example #login or //button[text()='Save']. |
| Drop Area | value | CSS selector or XPath of the element to drop onto. |
| Description (Optional) | notes | A comment shown in the step list and in Gherkin and Playwright exports. |
Usage
- Use for sortable lists and kanban boards.
- The drag is performed with mouse press, move and release, so both elements must be found on the page.
Example step (JSON)
{
"command": "dragAndDrop",
"target": "#card-1",
"value": "#column-done"
}Playwright equivalent
await page.locator('#card-1').dragTo(page.locator('#column-done'));Common options
- Make this step optional (Continue on failure): when checked, a failure in this step is recorded and the test continues with the next step.
- Execute step when JavaScript returns true: runs the step only when the JavaScript condition returns true. Otherwise the step is skipped.
See conditional steps and variables for details.