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

Hi All,

Hello all,
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

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

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: ‘10.16.15.55’, 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]
dragApp@file:///usr/local/lib/node_modules/appium/9E6C3842-B7E3-41AE-AAB3-02C385620053/bootstrap-6956a6a0786759f1.js:1160:39
eval code
eval@[native code]
startProcessing@file:///usr/local/lib/node_modules/appium/9E6C3842-B7E3-41AE-AAB3-02C385620053/bootstrap-6956a6a0786759f1.js:2685:30
bootstrap@file:///usr/local/lib/node_modules/appium/9E6C3842-B7E3-41AE-AAB3-02C385620053/bootstrap-6956a6a0786759f1.js:2753:31
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<String, Integer> swipeObject = new HashMap<String, Integer>();
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

It also doesn’t work on the simulator when I’m using swipe or Scroll to …

These scripts work for me (though I have only tried on a real device)

“UIATarget.localTarget().dragFromToForDuration({x:160, y:400}, {x:160, y:200},1);”
“UIATarget.localTarget().flickFromTo({x:160, y:400}, {x:160, y:200});”

I’m just executing them using the C# dotnetdriver
driver.ExecuteScript(command, null);

Have a look here for more info on the commands
https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomationInstrument.html

Watch This : https://www.youtube.com/watch?v=9rHe0r6YsVg