Swipe actions are not performed in simulator


i need to swipe(up/down/right/left) on some object in simulator(ios), i’m unable to do that

same thing is working in ios device

Plz help

Explain what commands you are using. What does your test case look like? Can you post server logs? What version of appium are you using? What version of ios? xcode?

I believe apple remove support for swipe actions in simulator IOS 7 , If so please ignore my question


He yup, that’s the case.

Hi guys,
Swipe functionality is not working with simulator 7.1/8.0 when i tried tried to swipe in scrollview!

So are you guys sure swipe functionality will not work in IOS simulators ??

I am working on:

  • Mac Mini with OS version 10.10.
  • Xcode 6.0
  • Appium Version 1.3.5

So whenever i launch my application and try to swipe Images in my application !! Im not able to swipe between images
i tried with multiple code changes but no luck I’m not able to swipe

Here is the java script code snippet I’m using
three attempts i did but no luck

  1. iDriver.swipe(68, 184, 250, 191,1000); or iDriver.swipe(68, 184, 250, 191,1);

  2. ((JavascriptExecutor)iDriver).executeScript(“mobile: swipe”, new HashMap() {{ put(“touchCount”, 1); put(“startX”, 68); put(“startY”, 184); put(“endX”, 250); put(“endY”, 191); put(“duration”, 2); }});

  3. public static void swipe(IOSDriver iDriver)
    JavascriptExecutor js = (JavascriptExecutor) iDriver;
    HashMap swipeObject = new HashMap();
    swipeObject.put(“touchcount”, 3);
    swipeObject.put(“startX”, 198);
    swipeObject.put(“startY”, 178);
    swipeObject.put(“endX”, 130);
    swipeObject.put(“endY”, 178);
    swipeObject.put(“duration”, 2);
    js.executeScript(“mobile: swipe”, swipeObject);

Below is the error which is shown is terminal when i run this script
info: <-- POST /wd/hub/session/562ae742-f817-4bfe-82f9-2cac7df7b704/element/9/click 200 276.947 ms - 74 {“status”:0,“value”:"",“sessionId”:“562ae742-f817-4bfe-82f9-2cac7df7b704”}
info: --> POST /wd/hub/session/562ae742-f817-4bfe-82f9-2cac7df7b704/execute {“args”:[{“duration”:2,“endY”:191,“touchCount”:1,“endX”:250,“startY”:184,“startX”:68}],“script”:“mobile: swipe”}
info: [debug] Tried to execute non-existent mobile command ‘swipe’. Most mobile commands have been ported to official client library methods. Please check your Appium library for more information and documentation
info: [debug] Responding to client that a method is not implemented
info: <-- POST /wd/hub/session/562ae742-f817-4bfe-82f9-2cac7df7b704/execute 501 0.924 ms - 158


error will be shown on eclipse console
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: 4 milliseconds
Build info: version: ‘2.43.0’, revision: ‘accb3003b9fb8f7cae30f9669b4c594a065396a6’, time: ‘2014-09-09 22:22:51’
System info: host: ‘sncradms-Mac-mini-5.local’, ip: ‘’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.10’, java.version: ‘1.8.0_25’
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities [{app=/Users/demappa.banashetti/Desktop/SyncDrive.app, networkConnectionEnabled=false, warnings={}, databaseEnabled=false, deviceName=iPhone 5, platform=MAC, desired={app=/Users/demappa.banashetti/Desktop/SyncDrive.app, platformVersion=8.0, platformName=iOS, deviceName=iPhone 5}, platformVersion=8.0, webStorageEnabled=false, locationContextEnabled=false, browserName=iOS, takesScreenshot=true, javascriptEnabled=true, platformName=iOS}]
Session ID: 562ae742-f817-4bfe-82f9-2cac7df7b704
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:508)
at com.sncr.auto.pages.PhotosPage.swipeLeftToRight(PhotosPage.java:380)
at com.sncr.auto.tests.provFlow.testLogin(provFlow.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

and when i used appium swipe method like
iDriver.swipe(68, 184, 250, 191,1000); or iDriver.swipe(68, 184, 250, 191,1);

I will Get below error logs in terminal

info: [debug] Sending command to instruments: au.dragApp(68,184,250,191,0.001)
info: [debug] [INST] 2015-02-23 13:41:31 +0000 Debug: Got new command 29 from instruments: au.dragApp(68,184,250,191,0.001)
info: [debug] [INST] 2015-02-23 13:41:31 +0000 Debug: evaluating au.dragApp(68,184,250,191,0.001)
info: [debug] [INST] 2015-02-23 13:41:31 +0000 Debug: target.dragFromToForDuration({x:“68”, y:“184”}, {x:“250”, y:“191”}, “0.001”)
info: [debug] [INST] 2015-02-23 13:41:31 +0000 Debug: duration value must be greater than or equal to 0.5 or less than 60
info: [debug] [INST] 2015-02-23 13:41:31 +0000 Error: VerboseError: duration value must be greater than or equal to 0.5 or less than 60
info: [debug] Socket data received (93 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {“status”:17,“value”:“duration value must be greater than or equal to 0.5 or less than 60”}
info: [debug] Responding to client with error: {“status”:17,“value”:{“message”:“An error occurred while executing user supplied JavaScript.”,“origValue”:“duration value must be greater than or equal to 0.5 or less than 60”},“sessionId”:“96f16815-579a-49be-aa9c-6242e4243c76”}
info: <-- POST /wd/hub/session/96f16815-579a-49be-aa9c-6242e4243c76/touch/perform 500 308.273 ms - 228
info: [debug] [INST] 2015-02-23 13:41:31 +0000 Error: Error during eval: dragFromToForDuration@[native code]
eval code
eval@[native code]
global code@file:///usr/local/lib/node_modules/appium/9E6C3842-B7E3-41AE-AAB3-02C385620053/bootstrap-6956a6a0786759f1.js:2762:10
info: [debug] [INST] 2015-02-23 13:41:31 +0000 Debug: responding with:
info: [debug] [INST] 2015-02-23 13:41:31 +0000 Debug: Running system command #30: /usr/local/Cellar/node/0.10.36/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:17,“value”:“duration value must be greater than or equal to 0.5 or less than 60”}…

and Im using below code also but no luck it’s also not working

public static void swipe(IOSDriver iDriver)
JavascriptExecutor js = (JavascriptExecutor) iDriver;
HashMap swipeObject = new HashMap();
swipeObject.put(“touchcount”, 3);
swipeObject.put(“startX”, 198);
swipeObject.put(“startY”, 178);
swipeObject.put(“endX”, 130);
swipeObject.put(“endY”, 178);
swipeObject.put(“duration”, 2);
js.executeScript(“mobile: swipe”, swipeObject);

so can anyone help me with this issue ? is swipe functionality working fine with simulators and is working correctly in scrollview??

Thanks in advance

I don’t have too much to add here other than identifying that I have the same issues as Demappa.
I am using appium 1.3.7.

I have methods such as this that work fine on my devices, not on either ios 7/8 simulator. The mobile ScrollTo method also is not finding the elements scrolled off page.

Albeit I’m on Xcode 6.1 ( a few minor revs behind).
I’ll look at github. I know iOS 7 simulator swiping is broken - it’s hard to tell on the appium discuss boards if it’s broken also for iOS 8. I see contrary posts to this. Sorry if this has been declared somewhere else before.

Thanks in advance!

def bb_swipe(start_x_percentage, start_y_percentage, end_x_percentage, end_y_percentage,duration)
    width = $driver.window_size[:width]
    height =  $driver.window_size[:height]

    start_x_pixel = start_x_percentage * width
    start_y_pixel = start_y_percentage * height
    end_x_pixel = end_y_percentage * width
    end_y_pixel = end_y_percentage * height

    action = Appium::TouchAction.new.press(x: start_x_pixel, y: start_y_pixel).wait(duration).move_to(x: end_x_pixel, y:  end_y_pixel).release()

  def ios_bb_swipe_right
    bb_swipe(0.95, 0.2, 0.1, 0.2, 500)

I been down this road before, I ended up using a workaround for swiping on simulators. Check it out: https://github.com/vicwomg/swipeInWindow.py

Wow Craig, this works great!

Hi Craig,

Is there anything similar in JAVA too ?

I used https://github.com/vicwomg/swipeInWindow.py in my Java code like this:
ProcessBuilder processBuilder = new ProcessBuilder(
“iOS Simulator”, “0.5”, “0.9”, “0.5”, “0.3”);

Tried swipeInWindow.py solution and not working for Appium 1.4.13, Xcode 7.0.1 & iOS Simulator 8.x.

Java code is executed and didn’t throw any error. However, scroll is not happening.

I just coped swipeInWindow.py file and provided the path. I use Eclipse and not sure if there is any configuration to be done to run python script.

Is this same status for others?

I think there is a bug in the swipe command , there is no delay before the swipe function is executed
first I tried …

What didn’t work:
wd.swipe(300, 300, 1, 300, 1500);

Discovered after I enabled “show touches” in developer options that it was executed before the command before it finishes.

String firstName = wd.findElementByName(“aerobics 101”).getText(); //random check on an object in the list to delay
Assert.assertEquals(“aerobics 101”, firstName);
wd.swipe(300, 300, 1, 300, 1500);