ピンチ
画面上の指定された要素でピンチジェスチャーを実行します。
情報
ピンチはネイティブモバイルジェスチャーに基づいて 行われます。次のドライバーのみでサポートされています:
- Androidの場合はappium-uiautomator2-driver
- iOSの場合はappium-xcuitest-driver
このコマンドは、以下の最新コンポーネントでのみ動作します:
- Appiumサーバー(バージョン2.0.0以上)
appium-uiautomator2-driver
(Android用)appium-xcuitest-driver
(iOS用)
互換性の問題を避けるために、ローカルまたはクラウドベースのAppium環境を定期的に更新してください。
使用法
$(selector).pinch({ duration, scale })
パラメータ
名前 | 型 | 詳細 |
---|---|---|
options オプション | PinchOptions | ピンチオプション(オプション) |
options.duration オプション | number | ピンチを実行する速さのミリ秒単位の時間。最小は500 ms、最大は10000 msです。デフォルトは1500 ms(1.5秒)です(オプション) |
options.scale オプション | number | 画面に対してピンチの大きさを表すスケール。有効な値は0..1の範囲の浮動小数点数であり、1.0は100%です(オプション) |
例
pinch.js
it('should demonstrate a pinch on Google maps', async () => {
const mapsElement = $('//*[@resource-id="com.google.android.apps.maps:id/map_frame"]')
// Pinch with the default duration scale
await mapsElement.pinch()
// Pinch with a custom duration and scale
await mapsElement.pinch({ duration: 4000, scale: 0.9 })
})