Unable to perform swipe in Appium

I am unable to swipe an element . Tried many options

  1. e.swipe(SwipeElementDirection.RIGHT, 6000);
    Tried changing the duration to suit the swipe but it just doesn’t reach the desired co-ordinates.This attempts to swipe but is ultimately unable to.

  2. touchaction.press(center.x,center.y).waitAction(400).moveTo(center.x+157, center.y).release();

On debugging the script crashes on the touchaction.perform() throwing the error : org.openqa.selenium.WebDriverException: An error occurred while executing user supplied JavaScript.

  1. JavascriptExecutor js =(JavascriptExecutor)(driver.innerDriver);
    HashMap<String,Integer> swipeObject = new HashMap<String,Integer>();
    swipeObject.put(“startX”, center.x);
    swipeObject.put(“StartY”, center.y);
    swipeObject.put(“endX”, center.x+157);
    swipeObject.put(“endY”, center.y);
    swipeObject.put(“duration”, 4);
    js.executeScript(“mobile: swipe”, swipeObject);

The above script gives the org.openqa.selenium.WebDriverException: Not yet implemented. error. I have tried using this with both webelement and the MobileElement.

  1. new Actions(driver.innerDriver).dragAndDropBy(element, center.x+157, center.y).build().perform(); gives Not Yet Implemented error.

Any workaround possible for the swipe function.

This might help u.


Thanks for the response but I am keeping the y-axis constant. center.y represents the y axis which I am keeping constant.So, if you could suggest something else.

are you using AppiumDriver or WebDriver?

I am using the AppiumDriver

Reduce the x coordinates and try once… U might have given the x axis which is more than the element size…


The co-ordinates are correct. The code was working fine when I implemented it . Its not working for the past 1 month now.