DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(“deviceName”, “emulator-5554”);
dc.setCapability(“BROWSER_NAME”, “android”);
dc.setCapability(“platformName”, “Android”);
dc.setCapability(“appPackage”, “com.poshmark.app”);
dc.setCapability(“appActivity”, “com.poshmark.ui.MainActivity”);
try {
driver = new RemoteWebDriver(new URL(“http://127.0.0.1:4723/wd/hub”), dc);
wait = new WebDriverWait(driver, 10);
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
io.appium.java_client.TouchAction action = new TouchAction((MobileDriver)driver);
action.press(PointOption.point(startx, starty)).moveTo(PointOption.point(startx, endy)).release().perform();
I tried this code, but error occured
Exception in thread “AWT-EventQueue-0” java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebDriver cannot be cast to io.appium.java_client.MobileDriver
at com.appium.example.FirstAppiumTest.scrollDown(FirstAppiumTest.java:194)
at com.appium.example.FirstAppiumTest.GatherName(FirstAppiumTest.java:206)
at com.appium.example.FirstAppiumTest.actionPerformed(FirstAppiumTest.java:176)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Please need help!!!
AddNote: I am using java-client6.1.0.jar