Andoni Da Silva :
I am trying to swipe down a modal view in iOS using Appium with java.
I have tried this two ways unsuccessfully:
JavascriptExecutor js2 = (JavascriptExecutor) driver;
HashMap<String, String> scrollObject2 = new HashMap<String, String>();
scrollObject2.put("x", "200");
scrollObject2.put("y", "550");
scrollObject2.put("direction", "down");
js2.executeScript("mobile: swipe", scrollObject2);
TouchAction action = new TouchAction(driver);
action.press(PointOption.point(200, 550)).moveTo(PointOption.point(200, 700)).release().perform();
What I am doing wrong? is another correct way to achieve this?
Thanks!
Vault23 :
You should do it using js script executor.
No need to add coordinates like you did, just try something like this:
HashMap<String, String> scrollObject = new HashMap<>();
JavascriptExecutor js = driver;
scrollObject.put("direction", "down");
js.executeScript("mobile: scroll", scrollObject); //or "mobile: swipe"
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=336720&siteId=1