メインコンテンツへスキップ

ドラッグアンドドロップ

アイテムを目的の要素または位置にドラッグします。

情報

このコマンドの機能は、アプリケーションでのドラッグアンドドロップの実装方法に大きく依存します。問題が発生した場合は、#4134に例を投稿してください。

使用方法
$(selector).dragAndDrop(target, { duration })
パラメータ
名前詳細
targetElementDragAndDropCoordinate目的の要素、またはxとyのプロパティを持つオブジェクト
options
オプション
DragAndDropOptionsdragAndDropコマンドオプション
options.duration
オプション
数値ドラッグにかける時間
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 })
})

ようこそ!お手伝いしましょうか?

WebdriverIO AI Copilot