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