From 46b53f33d3723bd106d7ed86a430cd5b97f6c176 Mon Sep 17 00:00:00 2001 From: Mohammad Monfared <74588305+mmonfared@users.noreply.github.com> Date: Mon, 18 Mar 2024 00:29:37 +0400 Subject: [PATCH] Update README.md Resolves #17 --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 9b21f36..7bfc8f9 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ driver.executeScript("gesture: swipe", Map.of("elementId", scrollView.getId(), # scrollElementIntoView +**JAVA** ```java RemoteWebElement scrollView = (RemoteWebElement) wait.until(presenceOfElementLocated(AppiumBy.accessibilityId("Swipe-screen"))); @@ -83,17 +84,35 @@ driver.executeScript("gesture: scrollElementIntoView", Map.of("scrollableView", "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