پرش به محتوای اصلی

پینچ (نیشگون)

Performs a pinch gesture on the given element on the screen.

اطلاعات

Pinching is done based on native mobile gestures. It is only supported for the following drivers:

This command only works with the following up-to-date components:

  • Appium server (version 2.0.0 or higher)
  • appium-uiautomator2-driver (for Android)
  • appium-xcuitest-driver (for iOS)

Make sure your local or cloud-based Appium environment is regularly updated to avoid compatibility issues.

Usage
$(selector).pinch({ duration, scale })
Parameters
NameTypeDetails
options
optional
PinchOptionsگزینه‌های پینچ (اختیاری)
options.duration
optional
numberمدت زمان اجرای حرکت پینچ بر حسب میلی‌ثانیه، حداقل ۵۰۰ میلی‌ثانیه و حداکثر ۱۰۰۰۰ میلی‌ثانیه است. مقدار پیش‌فرض ۱۵۰۰ میلی‌ثانیه (۱.۵ ثانیه) می‌باشد (اختیاری)
options.scale
optional
numberمقیاس بزرگی پینچ نسبت به صفحه نمایش. مقادیر معتبر باید اعداد اعشاری در محدوده ۰ تا ۱ باشند، که ۱.۰ معادل ۱۰۰٪ است (اختیاری)
Example
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 })
})

Welcome! How can I help?

WebdriverIO AI Copilot