java - Cannot instantiate the type AppiumDriver -



java - Cannot instantiate the type AppiumDriver -

i have added next jars in projects build path:

java-client-2.0.0 http://appium.io/downloads.html >> appium client libraries >> java selenium-java-2.43.1 selenium-java-2.43.1-srcs

selenium-server-standalone-2.43.1 , here's code:

public class sampleapp{ webdriver dr; @test public void testapp() throws malformedurlexception, interruptedexception { string apkpath = "d:\\apkdump\\sampleapp.apk"; file app = new file (apkpath); desiredcapabilities capabilities= new desiredcapabilities(); capabilities.setcapability(capabilitytype.browser_name,""); capabilities.setcapability("devicename","testadb18"); capabilities.setcapability("platformname","android"); capabilities.setcapability("app",app.getabsolutepath()); capabilities.setcapability("apppackage", "com.test"); capabilities.setcapability("appactivity", "com.sampleapp.main"); dr = new appiumdriver(new url("http://127.0.0.1:4723/wd/hub"),capabilities); dr.manage().timeouts().implicitlywait(5, timeunit.seconds); } }

i getting reddish line below new appiumdriver says cannot instantiate type appiumdriver. if remove selenium jars error disappears can't resolve errors webdriver.

what conflict between jars?

saw similar question here run code , getting null pointer exception in case cant run it, giving run on saving code. secondly answer has been posted without using appiumdriver

you don't need downgrade or anything. there design alter in java client version 2.0.0 mention on site:

appiumdriver abstract class, utilize iosdriver , androiddriver both extend it.

so, alter driver line be:

dr = new androiddriver(new url("http://127.0.0.1:4723/wd/hub"),capabilities);

hope helps...

java selenium appium

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -