1

I have tried implementing the swipe method for android devices, but this method is not working in Appium 1.3.4. Below is the code I have written:

public void swipe() {
    JavascriptExecutor js = (JavascriptExecutor) driver;
    HashMap < String, Double > swipeObject = new HashMap < String, Double > ();
    swipeObject.put("startX", 0.95);
    swipeObject.put("startY", 0.5);
    swipeObject.put("endX", 0.05);
    swipeObject.put("endY", 0.5);
    swipeObject.put("duration", 1.0);
    js.executeScript("emulator: swipe", swipeObject);
}

And call the swipe() in required place in that same class. It throws error message like this:

org.openqa.selenium.WebDriverException: Not yet implemented. Please help us: http://appium.io/get-involved.html (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 7 milliseconds

Please anyone help me on this issue. Thanks

1 Answer 1

1

You should migrate action methods to TouchAction class, in case of swipe, try this:

def swipe(start_x, start_y, end_x, end_y)
    Appium::TouchAction.new.press(x: start_x, y: start_y).wait(1000).move_to(x:end_x, y:end_y).wait(500).release(x: end_x, y: end_y).perform
end

Check API in here: http://appium.github.io/java-client/io/appium/java_client/TouchAction.html

Instead of coordinated you can also pass elements.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.