Skip to content

Commit

Permalink
Code snippet for long press in Android Touchevent (Java and Python)
Browse files Browse the repository at this point in the history
Updating python script for longclick  touchevent in android.
  • Loading branch information
mgmanikandan87 committed Sep 20, 2013
1 parent 0d39509 commit 2ba82d1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/touch-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ new TouchActions(driver).longPress(imageView).perform();

For Android Application:

Java:
```java
WebElement element = wd.findElement(By.name("API Demo"));
JavascriptExecutor js = (JavascriptExecutor) wd;
Expand All @@ -21,6 +22,12 @@ tapObject.put("element", ((RemoteWebElement) element).getId());
js.executeScript("mobile: longClick", tapObject);
```

Python:
```python
element = wd.find_element_by_xpath("your_element_xpath")
wd.execute_script("mobile: longClick",{ "touchCount": 1, "x": 0, "y": 300, "element":element.id })
```

Currently Appium support some of the gestures in the Touch Actions API:

* flick
Expand Down

0 comments on commit 2ba82d1

Please sign in to comment.