JUnit Appium Tests with Maven

Hi i am using Appium to automate a mobile website.

I have encountered a problem where i have to use the systempropertyVariables set in my pom.xml under the maven-surefire-plugin.

So i have to run the tests as maven test.

But doing this i get an error when i am instantiating the AppiumDriver() .

Any help here.

Here is the code and the maven error.

try 
{
    linker = new URL("http://127.0.0.1:4723/wd/hub");
driver = new AppiumDriver(linker, capabilities);
driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(120, TimeUnit.SECONDS);
String testurl1 = System.getProperty("cpt.base.url");
System.out.println(" ---- "+testurl1);
}
catch (MalformedURLException e) 
{
System.out.println("URL init error");
}

And the error

Running LoginTest
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.142 sec <<< FAILURE! - in LoginTest
testLogin(LoginTest)  Time elapsed: 0.074 sec  <<< ERROR!
java.lang.NoSuchMethodError: org.openqa.selenium.remote.ErrorHandler.<init>                                         (Lorg/openqa/selenium/remote/ErrorCodes;Z)V
at io.appium.java_client.AppiumDriver.<clinit>(AppiumDriver.java:38)
at LoginTest.setUp(LoginTest.java:41)

The 41 st line is my new AppiumDriver() line

I am using Appium version 1.2.4.1 java-client 1.5.0 and selenium 2.42.2

Can you switch to the latest versions for java-client and selenium?

Thanks @jonahss that did the trick …

1 Like