ドラッグ&ドロップ
アイテムを目的の要素または位置にドラッグします。
情報
このコマンドの機能は、アプリでの ドラッグ&ドロップの実装方法に大きく依存します。問題が発生した場合は、 #4134に例を投稿してください。
また、ドラッグする要素とドロップする対象の両方が画面に表示されていることを確認してください。
このコマンドは、以下の最新コンポーネントでのみ動作します:
- Appium サーバー(バージョン2.0.0以上)
appium-uiautomator2-driver
(Android用)appium-xcuitest-driver
(iOS用)
互換性の問題を避けるため、ローカルまたはクラウドベースのAppium環境を定期的に更新してください。
使用法
$(selector).dragAndDrop(target, { duration })
パラメータ
Name | Type | Details |
---|---|---|
target | Element, DragAndDropCoordinate | 目的の要素またはxとyプロパティを持つオブジェクト |
options optional | DragAndDropOptions | dragAndDropコマンドのオプション |
options.duration optional | Number | ドラッグにかかる時間 |
例
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 })
})