appium_lib iOS 7 Sim Broken Swipe?

I’m trying to run tests on the iOS 7 sim, and one action I need to perform is Swipe. In touch_actions.rb, there’s a method for swiping (called "swipe) which doesn’t seem to do anything. In the comments above it says “Note that iOS 7 simulators have broken swipe”. Is there a fix or work around for performing swipe?

I’m calling swipe via:
action = start_x:50, start_y:25, end_x:50, end_y:250


The only work around I’ve found is this:

You can use:

  1. scrollTo- if you have the element you want to scroll to.
  2. scroll via JS - in Java code sample is on appium tutorial:
  3. Use real device:)

The scroll to using script works with ruby as well: execute_script(“mobile: scrollTo”, object)

The swipe, at least horizontal, works fine for me as well.

Is there a way to perform multi touch actions with the execute_script? How to do a longpress and scroll down (which is equivalent to pull to refresh action)

Thanks for the suggestions. Unfortunately the scrollTo method won’t work (:mobile methods deprecated) and the python script workaround isn’t ideal for us.

Hi palas, I’m trying to pinch and zoom using swipe in ruby, could you please share your command for the horizontal swipe? I keep getting a javascript error!

Hi @Aish

I am not sure how are you planning to pinch to zoom using swipe… What is your strategy for that?

To swipe I am using a command like this:

driver.execute_script(“mobile: swipe”, startX: 10, startY: 10, endX: 50, endY: 10, duration: 0.5)

This will swipe from (10,10) to (50,10). I’ve created a method to implement that to specific elements, so you pass an element and based on the element position and size swipe on it, but I don’t know how can you do make it pinch to zoom with that…

I thought of using multi touch. But I dont think thats possible on using execute script. Is this working on IOS 7 simulator? I’m not able to see it work there :frowning:

Yes, it is working here.

What Appium version are you using? I am asking that because there are several bugs with the 1.2.2 version, it crashes instruments when accessing multiple elements and other major bugs, so I gave up on it and I am using version 1.1.0 - and in that version swipe works for the elements I am swiping on.


Ah! I’m on 1.2.2… I’ll try downgrading and check! :slight_smile: Thanks for that!

Before downgrading the node version it probably worth to just download the app in the version 1.1.0, run the server from there and see how it performs.

Does the :mobile swipe method still work on 1.1.0? I thought they were deprecated after 1.x. When I try to call it I get an error regarding a non-implemented method (the :mobile method)


I m trying to do horizontal swipe for iOS 7. I used below code.
JavascriptExecutor js = (JavascriptExecutor) wd;
HashMap<String, Double> swipeObject = new HashMap<String, Double>();
swipeObject.put(“touchCount”, 1.00);
swipeObject.put(“startX”, 0.73);
swipeObject.put(“startY”, 2.11);
swipeObject.put(“endX”, 2.26);
swipeObject.put(“endY”, 2.12);
swipeObject.put(“duration”, 0.5);
js.executeScript(“mobile:swipe”, swipeObject);
I m getting error,

Any solution (hacky or not) to simulate swipe on real ios7 devices?

Real ios 7 devices should work without issue, this problem is isolated to simulators.

yeah, finally got it working. Strange, not sure what I was doing wrong. Tried now with pixel, percentage, applied to an element or all app and it works fine.

Any updates for swipe on iOS simulator 7??

could u post javacode to swipe from x to y

Hi guys,

I needed the swipe functionality to activate and present a left pane menu on an iPad application my team is developing and it worked after a few attempts of trying different methods etc.

Please see the below java code as a reference on what worked for me:

HashMap hm = new HashMap<String, Integer>() {{ put("touchCount", 1); put("startX", 0); put("startY", 232); put("endX", 119); put("endY", 227); put("duration", 1); }};
        ((JavascriptExecutor) driver).executeScript("mobile: swipe", hm);

Hope this helped.