I'm trying to test my application in eclipse IDE using java throwing this error. I started appium server also. gave matching port numbers too. this is my log trace. help me out.Thanks in advance
This is the code I used for testing my android app using appium:
public class MilonowFirstTest { static AppiumDriver<WebElement> driver; // @BeforeClass public static void main(String[] args) throws MalformedURLException //public void Setup() throws MalformedURLException { DesiredCapabilities cap = new DesiredCapabilities(); //cap.setCapability(AndroidMobileCapabilityType.De, value); cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android emulator"); //cap.setCapability(MobileCapabilityType.APP_PACKAGE, value); cap.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.test.myapp"); //cap.setCapability(MobileCapabilityType.APP, ""); cap.setCapability("avd", "Honor 7X API 27"); cap.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android"); cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, "23"); cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium"); driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wb/hub"), cap); Assert.assertNotNull(driver.getContext()); } // @Test() // public void SimpleTest() // { // Assert.assertNotNull(driver.getContext()); // } } Error log:
Exception in thread "main" org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z' System info: host: 'DESKTOP-4DSS7OC', ip: '192.168.2.21', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161' Driver info: driver.version: AndroidDriver at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:195) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:209) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130) at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:94) at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:93) at testcase.MilonowFirstTest.main(MilonowFirstTest.java:37) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:185) ... 13 more Caused by: org.openqa.selenium.WebDriverException: Unable to parse remote response: The URL '/wb/hub/session' did not map to a valid resource Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z' System info: host: 'DESKTOP-4DSS7OC', ip: '192.168.2.21', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161' Driver info: driver.version: AndroidDriver at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:111) ... 18 more