Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AppiumTestDistribution/appium-gestures-plugin
Appium plugin designed to perform gestures using W3C Actions.
https://github.com/AppiumTestDistribution/appium-gestures-plugin
Last synced: 26 days ago
JSON representation
Appium plugin designed to perform gestures using W3C Actions.
- Host: GitHub
- URL: https://github.com/AppiumTestDistribution/appium-gestures-plugin
- Owner: AppiumTestDistribution
- Created: 2021-05-31T13:03:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-17T23:34:38.000Z (9 months ago)
- Last Synced: 2024-11-05T10:44:09.363Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 767 KB
- Stars: 49
- Watchers: 7
- Forks: 13
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-learning - Appium Gestures Plugin
README
# appium-gestures-plugin [![npm version](https://badge.fury.io/js/appium-gestures-plugin.svg)](https://badge.fury.io/js/appium-gestures-plugin)
This is an Appium plugin designed to perform basic gestures using W3C Actions.
## Prerequisite
Appium version 2.0
## Installation - Server
Install the plugin using Appium's plugin CLI, either as a named plugin or via NPM:
```shell
appium plugin install --source=npm appium-gestures-plugin
```## Activation
The plugin will not be active unless turned on when invoking the Appium server:
```shell
appium --use-plugins=gestures
```# Usage
Sample app used to demonstrate below gesture is available [here](https://github.com/webdriverio/native-demo-app/releases)
# Swipe Left
```java
RemoteWebElement carousel = (RemoteWebElement) wait.until(presenceOfElementLocated(AppiumBy.accessibilityId("Carousel")));driver.executeScript("gesture: swipe", Map.of("elementId", carousel.getId(), "percentage", 50, "direction", "left"));
```# Swipe Right
```java
RemoteWebElement carousel = (RemoteWebElement) wait.until(presenceOfElementLocated(AppiumBy.accessibilityId("Carousel")));driver.executeScript("gesture: swipe", Map.of("elementId", carousel.getId(), "percentage", 50, "direction", "right"));
```# Swipe Up
```java
RemoteWebElement scrollView = (RemoteWebElement) wait.until(presenceOfElementLocated(AppiumBy.accessibilityId("Swipe-screen")));driver.executeScript("gesture: swipe", Map.of("elementId", scrollView.getId(),
"percentage", 50,
"direction", "up"));
```# Swipe Down
```java
RemoteWebElement scrollView = (RemoteWebElement) wait.until(presenceOfElementLocated(AppiumBy.accessibilityId("Swipe-screen")));driver.executeScript("gesture: swipe", Map.of("elementId", scrollView.getId(),
"percentage", 50,
"direction", "down"));
```# scrollElementIntoView
**JAVA**
```java
RemoteWebElement scrollView = (RemoteWebElement) wait.until(presenceOfElementLocated(AppiumBy.accessibilityId("Swipe-screen")));driver.executeScript("gesture: scrollElementIntoView", Map.of("scrollableView", scrollView.getId(),
"strategy", "accessibility id",
"selector", "WebdriverIO logo",
"percentage", 50,
"direction", "up",
"maxCount", 3));```
**PYTHON**
```python
list_view = driver.find_element(by=AppiumBy.ID, value='android:id/list')
driver.execute_script('gesture: scrollElementIntoView',
{'scrollableView': list_view.id, 'strategy': 'accessibility id', 'selector': 'Picker',
'percentage': 50, 'direction': 'up', 'maxCount': 3})
```Sample app used to demonstrate below gesture is available [here](https://github.com/AppiumTestDistribution/appium-demo/blob/main/VodQA.apk)
# Drag and Drop
**JAVA**
```java
RemoteWebElement source = (RemoteWebElement) wait.until(elementToBeClickable(AppiumBy.accessibilityId("dragMe")));
RemoteWebElement destination = (RemoteWebElement) wait.until(elementToBeClickable(AppiumBy.accessibilityId("dropzone")));driver.executeScript("gesture: dragAndDrop", Map.of("sourceId", source.getId(), "destinationId", destination.getId()));
```
**PYTHON**
```python
el1 = driver.find_element(by=AppiumBy.ID, value='io.appium.android.apis:id/drag_dot_1')
el2 = driver.find_element(by=AppiumBy.ID, value='io.appium.android.apis:id/drag_dot_2')driver.execute_script('gesture: dragAndDrop', {
'sourceId': el1.id,
'destinationId': el2.id,
})
```# Double Tap
```java
RemoteWebElement doubleTapMe = (RemoteWebElement) driver.findElement(AppiumBy.accessibilityId("doubleTapMe"));driver.executeScript("gesture: doubleTap", Map.of("elementId", doubleTapMe.getId()));
```# Long Press
Pressure has to be between 0 and 1.
```java
RemoteWebElement longPress = (RemoteWebElement) driver.findElement(AppiumBy.accessibilityId("longpress"));driver.executeScript("gesture: longPress", Map.of("elementId", longPress.getId(), "pressure", 0.5, "duration", 800));
```
# WDIO
```js
await driver.execute('gesture: dragAndDrop', { sourceId, destinationId });
```## Supported
- Swipe Left, right, up and down
- scrollElementIntoView
- Drag and Drop
- Double Tap
- Long Press### TODO
- zoom
- multi finger swipe