I am trying to automate my app using appium simulator. I have done the Appium setup. When I Run the sample program attached below. Java program terminated after launching the iphone simulator with the below error Please help me if I am missing any .JAR file?

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/HttpVerb
    at io.appium.java_client.AppiumDriver.postC(AppiumDriver.java:644)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:51)
    at myFirstappium.main(myFirstappium.java:21)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.HttpVerb
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

import io.appium.java_client.AppiumDriver;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

public class myFirstappium {
  public static void main(String[] args) {

      try{


        DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.setCapability("appium-version", "1.0");
            capabilities.setCapability("platformName", "iOS");
            capabilities.setCapability("platformVersion", "8.3");
            capabilities.setCapability("deviceName", "iPhone 6");
            capabilities.setCapability("app", "/Users/Gan/TEST_UAT.app");
            URL serverAddress = new URL("http://127.0.0.1:4723/wd/hub");
            WebDriver wd = new AppiumDriver(serverAddress, capabilities);
            wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
            wd.findElement(By.name("Sign in")).click();
            wd.findElement(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIATextField[1]")).sendKeys("test");
            wd.findElement(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIASecureTextField[1]")).sendKeys("ok");
            wd.close();
      }
      catch (Exception e)
      {
      System.out.println (e);
  }
    }

}
2

There are 2 answers

0
Alexei Barantsev On

This class has been deprecated for more that a year, and recently it was deleted: https://github.com/SeleniumHQ/selenium/commit/46d425d3a5fa8e21cf955d7b41bf436548e4971d This change is included in Selenium version 2.46.

That implies that Appium version you use is not compatible with Selenium 2.46

0
kiruthika Palanisamy On

I faced the same Issue in working with Android. But when I changed the AppiumDriver to RemoteWebdriver the issue got fixed.