3
votes

While initilizing android driver in emulator device produced sessionNotCreatedException. Am new for android automation. Anyone please help?.

Nov 18, 2016 5:35:25 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end Nov 18, 2016 5:35:25 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Falling back to straight W3C remote end connection Nov 18, 2016 5:35:25 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Falling back to original OSS JSON Wire Protocol. org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: 'unknown', revision: 'c7b525d', time: '2016-09-01 14:52:30 -0700' System info: host: 'thangaraj', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.19.0-25-generic', java.version: '1.8.0_101' Driver info: driver.version: AndroidDriver at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:618) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40) 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:242) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:36) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:114) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:132) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:92) at initialize.Setup.initialize(Setup.java:230) at script.ScriptRunner.setup(ScriptRunner.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:100) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:216) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:143) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:307) at org.testng.SuiteRunner.run(SuiteRunner.java:270) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1284) at org.testng.TestNG.runSuitesLocally(TestNG.java:1209) at org.testng.TestNG.runSuites(TestNG.java:1124) at org.testng.TestNG.run(TestNG.java:1096) at runTestNG.RunTestng.runTestNG(RunTestng.java:19) at runner.Runner.main(Runner.java:11) Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=/home/ionixx/Android/Sdk/platform-tools/xxxxxxxxxxxxxxx.apk, appPackage=xxxxxxxxxxxxxxxxxx, appActivity=xxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx, noReset=true, browserName=, maxSession=10, platformName=Android, version=4.4, deviceName=Nexus1}], required capabilities = null Build info: version: 'unknown', revision: 'c7b525d', time: '2016-09-01 14:52:30 -0700' System info: host: 'thangaraj', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.19.0-25-generic', java.version: '1.8.0_101' Driver info: driver.version: AndroidDriver at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:80) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:597)

3

3 Answers

0
votes

Please check the packages that you included selenium 2.53.1 source and 2.53.1 jar. and include all the jar files present in the lib folder after extracting selenium 2.53.1. -use testng.xml file to set the flow of the test case.

Authorship: Imran Ansari, colleague of mine.

0
votes

I solved this issue by just changing the app path

 capabilities.setCapability("app", <<apk file path>>);
0
votes

Working after changing the correct App path(apk path).