touchAction
非推奨警告
touchActionコマンドは**非推奨**であり、将来のバージョンで削除される予定です。actionコマンドをポインタタイプtouchと共に使用することをお勧めします。例:
await browser.action('pointer', {
  parameters: { pointerType: 'touch' }
})
タッチアクションAPIは、Appiumで自動化できるすべてのジェスチャーの基礎を提供します。現在、ネイティブアプリでのみ使用可能であり、ウェブアプリとのやり取りには使用できません。その核心は、*アドホック*な個々のアクションを連鎖させる機能であり、その後、デバイス上のアプリケーション内の要素に適用されます。使用できる基本的なアクションは次のとおりです。
- press(要素または(x、y)、またはその両方を通過)
- longPress(要素または(x、y)、またはその両方を通過)
- tap(要素または(x、y)、またはその両方を通過)
- moveTo(絶対的なx、y座標を渡す)
- wait(ms(ミリ秒単位)を渡す)
- release(引数なし)
使用方法
$(selector).touchAction(action)
パラメータ
| 名前 | 型 | 詳細 | 
|---|---|---|
| action | TouchActions | 実行するアクション | 
例
touchAction.js
it('should do a touch gesture', async () => {
    const screen = await $('//UITextbox');
    // simple touch action on element
    await screen.touchAction('tap');
    // simple touch action using selector and x y variables
    // tap location is 30px right and 20px down relative from the center of the element
    await screen.touchAction({
        action: 'tap', x: 30, y:20
    })
    // multi action on an element (drag&drop)
    await screen.touchAction([
        'press',
        { action: 'moveTo', x: 200, y: 300 },
        'release'
    ])
    // drag&drop to element
    const otherElement = await $('//UIAApplication[1]/UIAElement[2]')
    await screen.touchAction([
        'press',
        { action: 'moveTo', element: otherElement },
        'release'
    ])
});