Failed to create a new session. error in code for appium
Unable to create a new session. (Original error: Requested a new session but it continued) This error is displayed if I run my code a second time. Works fine the first time
Writing code for selenium
public static void main(String[] args) throws MalformedURLException{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.0");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("deviceName", "AndroidTest");
System.out.println("iii");
capabilities.setCapability("app", "/Users/gurpreet/Desktop/nimbuzz-3.2.0-rc4-debug.apk");
System.out.println("iii");
WebDriver driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
driver.findElement(By.id("com.nimbuzz:id/btnSignInSplash")).click();
}
}
Can anyone suggest a solution for this /
source to share
Use the following code
public static void main(String[] args) throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"Android Emulator");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,"Android");
capabilities.setCapability(MobileCapabilityType.APP, "C:/Users/gurpreet/Desktop/nimbuzz-3.2.0-rc4-debug.apk");
WebDriver driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
This code assumes your application server is running on localhost and port 4723
source to share