android - How to resolve NoSuchMethodError and appiumDriver error -
package demo; import java.net.malformedurlexception; import java.net.url; import org.openqa.selenium.by; import org.openqa.selenium.webelement; import org.openqa.selenium.remote.capabilitytype; import org.openqa.selenium.remote.desiredcapabilities; import org.openqa.selenium.remote.remotewebdriver; import io.appium.java_client.android.androiddriver; public class test { remotewebdriver driver; public static void main(string[] args)throws malformedurlexception, interruptedexception{ desiredcapabilities capabilities = new desiredcapabilities(); capabilities.setcapability("devicename", "samsung s4"); capabilities.setcapability("platformname", "android"); capabilities.setcapability(capabilitytype.browser_name, "chrome"); capabilities.setcapability("platformversion", "5.0.1"); remotewebdriver driver = new androiddriver(new url("http://127.0.0.1:4723/wd/hub"), capabilities); driver.get("http://www.google.com"); webelement keyword = driver.findelementbyname("q"); keyword.sendkeys("appium"); driver.findelement(by.id("btnk")).click(); thread.sleep(5000);
} }
error
exception in thread "main" java.lang.nosuchmethoderror: org.openqa.selenium.remote.errorhandler.(lorg/openqa/selenium/remote/errorcodes;z)v @ io.appium.java_client.appiumdriver.(appiumdriver.java:46) @ demo.test.main(test.java:31)
i have added essential jars files. when run code nothing happens on appium server. !
could recheck code once "capabilities.setcapability(capabilitytype.browser_name, "chrome");"
and jar related "import io.appium.java_client.android.androiddriver;"..
try import latest jar , run again.
capabilities.setcapability("platformname", "android"); capabilities.setcapability("apppackage", "com.android.browser"); capabilities.setcapability("appactivity","com.android.browser.browseractivity"); capabilities.setcapability("platformversion", "5.1");
Comments
Post a Comment