Hi All,
I am new to Appium, I am trying to swipe my app using below code but It returns the following error to me… Please do the needful asap.
My Code
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class ESFile {
public static RemoteWebDriver driver = null;
@BeforeTest
public void beforeTest() {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.3.4");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "5.0");
capabilities.setCapability("deviceName", "Nexus 5");
capabilities.setCapability("appPackage", "com.estrongs.android.pop");
capabilities.setCapability("appActivity", "com.estrongs.android.pop.view.FileExplorerActivity");
try {
driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(20L, TimeUnit.SECONDS);
}
@AfterTest
public void afterTest() {
driver.quit();
}
@Test
public void sample() throws InterruptedException {
Thread.sleep(4000);
swipe(1000.0,1010.0,100.0,1050.0,1.0);
Thread.sleep(2000);
swipe(1000.0,1010.0,100.0,1050.0,1.2);
Thread.sleep(2000);
driver.findElement(By.name("Xender")).click();
System.out.println("done");
}
public void swipe(double sx,double sy,double ex,double ey,double d)
{
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, Double> swipeObj = new HashMap<String, Double>();
swipeObj.put("touchCount",1.0);
swipeObj.put("startX", sx);
swipeObj.put("startY", sy);
swipeObj.put("endX", ex);
swipeObj.put("endY", ey);
swipeObj.put("duration", d);
js.executeScript("mobile: swipe", swipeObj);
}
}
Error
FAILED: sample
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: 10 milliseconds
Build info: version: ‘2.44.0’, revision: ‘76d78cf’, time: ‘2014-10-23 20:02:37’
System info: host: ‘I.local’, ip: ‘172.16.45.40’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.10.2’, java.version: ‘1.8.0_25’
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{appPackage=com.estrongs.android.pop, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=Nexus 5, platform=LINUX, appActivity=com.estrongs.android.pop.view.FileExplorerActivity, desired={appPackage=com.estrongs.android.pop, appActivity=com.estrongs.android.pop.view.FileExplorerActivity, appium-version=1.3.4, platformVersion=5.0, platformName=Android, deviceName=Nexus 5}, appium-version=1.3.4, platformVersion=5.0, webStorageEnabled=false, locationContextEnabled=false, browserName=Android, takesScreenshot=true, javascriptEnabled=true, platformName=Android}]
Session ID: 66f1562b-eeb1-4087-a455-9c1475273bc0
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 org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:508)
at sneerglaw.ESFile.swipe(ESFile.java:62)
at sneerglaw.ESFile.sample(ESFile.java:45)
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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)