mirror of
https://github.com/appium/appium.git
synced 2026-05-24 12:58:49 -05:00
Merge pull request #1186 from mgmanikandan87/patch-2
Code snippet for long press in Android Touchevent (Java and Python)
This commit is contained in:
@@ -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;
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user