appium_lib iOS 7 Sim Broken Swipe?

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.

Hi @AndyDee,

I followed your tips but it doesn’t work for me. I think the problem is the Simulator itself, not the script because I can run it well in real device ( iPad with ios 7, iPhone 5s with ios 8)
My currently workaround, thanks to @bootstraponline’s suggestion, is to use AppleScript to navigate to the center of the simulator window and keep pressing the mouse there while running the script and it works.

I port to java because the original version is written in python.I know it’s not an ideal solution but it’s the only one that work for me at this moment. My environment is Xcode 6.1, Appium 1.3 and it seems like Apple did not fix this yet

Hi @tbao,

I"m also looking for the workaround in java. Any chance you could share it?


Hi @Phil_Tran,

Can you follow this post: Swipe broken on 1.3.3? ios 8.1?

I have posted my solution in there before. Up until now I am still using that solution and it works just fine for me even though it looks pretty ugly.