selenium - I am getting session not created exception, i am using Kepler version of eclipse, appium 1.6.5 and AVD version 7.0, below are the TestNG error logs: -


log:org.openqa.selenium.sessionnotcreatedexception: unable create new remote session. desired capabilities = capabilities [{appactivity=com.knowarth.hrmsapp.ui.loginactivity, platformversion=7.0, androidpackage=com.knowarth.hrmsapp, platformname=android, device=android, devicename=nexus 5x api 24}], required capabilities = capabilities [{}] build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800' system info: host: 'ka-lpt-104', ip: '192.168.43.85', os.name: 'windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_60' driver info: driver.version: androiddriver @ io.appium.java_client.remote.appiumprotocolhandshake.lambda$1(appiumprotocolhandshake.java:95) @ java.util.optional.orelsethrow(unknown source) @ io.appium.java_client.remote.appiumprotocolhandshake.createsession(appiumprotocolhandshake.java:95) @ io.appium.java_client.remote.appiumcommandexecutor.doexecute(appiumcommandexecutor.java:111) @ io.appium.java_client.remote.appiumcommandexecutor.execute(appiumcommandexecutor.java:162) @ org.openqa.selenium.remote.remotewebdriver.execute(remotewebdriver.java:604) @ io.appium.java_client.defaultgenericmobiledriver.execute(defaultgenericmobiledriver.java:42) @ io.appium.java_client.appiumdriver.execute(appiumdriver.java:1) @ io.appium.java_client.android.androiddriver.execute(androiddriver.java:1) @ org.openqa.selenium.remote.remotewebdriver.startsession(remotewebdriver.java:244) @ org.openqa.selenium.remote.remotewebdriver.(remotewebdriver.java:131) @ org.openqa.selenium.remote.remotewebdriver.(remotewebdriver.java:144) @ io.appium.java_client.defaultgenericmobiledriver.(defaultgenericmobiledriver.java:38) @ io.appium.java_client.appiumdriver.(appiumdriver.java:88) @ io.appium.java_client.appiumdriver.(appiumdriver.java:112) @ io.appium.java_client.android.androiddriver.(androiddriver.java:73) @ com.ka.tests.appium_webinar.setup(appium_webinar.java:42) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.testng.internal.methodinvocationhelper.invokemethod(methodinvocationhelper.java:108) @ org.testng.internal.invoker.invokeconfigurationmethod(invoker.java:523) @ org.testng.internal.invoker.invokeconfigurations(invoker.java:224) @ org.testng.internal.invoker.invokeconfigurations(invoker.java:146) @ org.testng.suiterunner.privaterun(suiterunner.java:326) @ org.testng.suiterunner.run(suiterunner.java:289) @ org.testng.suiterunnerworker.runsuite(suiterunnerworker.java:52) @ org.testng.suiterunnerworker.run(suiterunnerworker.java:86) @ org.testng.testng.runsuitessequentially(testng.java:1301) @ org.testng.testng.runsuiteslocally(testng.java:1226) @ org.testng.testng.runsuites(testng.java:1144) @ org.testng.testng.run(testng.java:1115) @ org.testng.remote.abstractremotetestng.run(abstractremotetestng.java:132) @ org.testng.remote.remotetestng.initandrun(remotetestng.java:230) @ org.testng.remote.remotetestng.main(remotetestng.java:76)

the issue here is, creating session not closing it. hence when running test second time, says "unable allocate session".

use these methods start , stop appium , solves problem.

static appiumdriverlocalservice appiumservice; public static void start() throws ioexception {     appiumservicebuilder builder = new appiumservicebuilder().withargument(generalserverflag.session_override)                                    .withargument(generalserverflag.strict_caps);     appiumservice = builder.build();     appiumservice.start();     system.out.println("appium server started"); }  public static void stop() throws ioexception{     appiumservice.stop();     system.out.println("appium server stopped"); } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -