முக்கிய உள்ளடக்கத்திற்கு செல்க

dragAndDrop

Drag an item to a destination element or position.

தகவல்

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
NameTypeDetails
targetElement, DragAndDropCoordinatedestination element or object with x and y properties
options
optional
DragAndDropOptionsdragAndDrop command options
options.duration
optional
Numberhow long the drag should take place
Example
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 })
})

Welcome! How can I help?

WebdriverIO AI Copilot