Zum Hauptinhalt springen

dragAndDrop

Ziehen Sie ein Element zu einem Zielelement oder einer Position.

Info

Die Funktionalität dieses Befehls hängt stark davon ab, wie Drag-and-Drop in Ihrer Anwendung implementiert ist. Wenn Sie Probleme feststellen, posten Sie bitte Ihr Beispiel in #4134.

Verwendung
$(selector).dragAndDrop(target, { duration })
Parameter
NameTypDetails
targetElement, DragAndDropCoordinateZielelement oder Objekt mit x- und y-Eigenschaften
options
optional
DragAndDropOptionsdragAndDrop-Befehlsoptionen
options.duration
optional
Numberwie lange der Ziehvorgang dauern sollte
Beispiel
example.test.js
it('should demonstrate the dragAndDrop command', async () => {
const elem = $('#someElem')
const target = $('#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