dragAndDrop
Drag an item to a destination element or position.
info
The functionality of this command highly depends on the way drag and drop is implemented in your app. If you experience issues please post your example in #4134.
Usage
$(selector).dragAndDrop(target, { duration })
Parameters
| Name | Type | Details | 
|---|---|---|
| target | Element, DragAndDropCoordinate | destination element or object with x and y properties | 
| options optional  | DragAndDropOptions | dragAndDrop command options | 
| options.duration optional  | Number | how long the drag should take place | 
Example
- Asynchronous Mode
 - Synchronous Mode
 
example.test.js
it('should demonstrate the dragAndDrop command', async () => {
    const elem = await $('#someElem')
    const target = await $('#someTarget')
    // drag and drop to other element
    await elem.dragAndDrop(target)
    // drag and drop relative from current position
    await elem.dragAndDrop({ x: 100, y: 200 })
})
example.test.js
it('should demonstrate the dragAndDrop command', () => {
    const elem = $('#someElem')
    const target = $('#someTarget')
    // drag and drop to other element
    elem.dragAndDrop(target)
    // drag and drop relative from current position
    elem.dragAndDrop({ x: 100, y: 200 })
})
caution
Synchronous Mode will depcrecated with Node.js v16. With an update to the underlying Chromium version it became technically impossible to provide the same synchronous behavior. We recommend to start transition to asynchronous command execution. For more information, see our RFC.