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 is
Exception in thread "main" java.lang.NoSuchMethodError: org.openqa.selenium.remote.ErrorHandler.(Lorg/openqa/selenium/remote/ErrorCodes;Z)V at io.appium.java_client.AppiumDriver.(AppiumDriver.java:46) at demo.Test.main(Test.java:31)
I have added all the essential Jars files. When i run the code nothing happens on appium server. Any help !
Could you recheck the code once "capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");"
and also jar related to "import io.appium.java_client.android.AndroidDriver;"..
try import latest jar and run again.
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("appPackage", "com.android.browser");
capabilities.setCapability("appActivity","com.android.browser.BrowserActivity");
capabilities.setCapability("platformVersion", "5.1");