pinch
Performs a pinch gesture on the given element on the screen.
information
Pinching is done based on native mobile gestures. It is only supported for the following drivers:
- appium-uiautomator2-driver for Android
- appium-xcuitest-driver for iOS
Usage
browser.pinch({ duration, scale })
Parameters
Name | Type | Details |
---|---|---|
options optional | PinchOptions | pinch options (optional) |
options.duration optional | number | The duration in millisecond of how fast the pinch should be executed, minimal is 500 ms and max is 10000 ms. The default is 1500 ms (1.5 seconds) (optional) |
options.scale optional | number | The scale of how big the pinch should be according to the screen. Valid values must be float numbers in range 0..1, where 1.0 is 100% (optional) |
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 })
})