Appium opens app but crashes when executing test

Issue

Im using the next project to create a demo of appium using Windows Appium GUI and Android Studio:

https://github.com/RobertoTeresa/POCAppium

But when I try to execute the test with appium the app opens in the emulator but it doesn’t continue with the tests and exits with an error but sometimes it works fine when I restart Appium and the emulator

Error log

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
[INFO ] 2022-10-05 13:18:44.243 ServerManager:46 - starting appium server
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[Appium] Welcome to Appium v1.22.3
[Appium] Non-default server args:
[Appium]   port: 47492
[Appium]   sessionOverride: true
[Appium]   logFile: C:\AppiumPOC\Android_Pixel 4 API 3O\Server.log
[Appium] Appium REST http interface listener started on 0.0.0.0:47492
[HTTP] --> GET /wd/hub/status
[HTTP] {}
[debug] [GENERIC] Calling AppiumDriver.getStatus() with args: []
[debug] [GENERIC] Responding to client with driver.getStatus() result: {"build":{"version":"1.22.3"}}
[HTTP] <-- GET /wd/hub/status 200 10 ms - 68
[HTTP]
[HTTP] --> GET /wd/hub/status
[HTTP] {}
[debug] [GENERIC] Calling AppiumDriver.getStatus() with args: []
[debug] [GENERIC] Responding to client with driver.getStatus() result: {"build":{"version":"1.22.3"}}
[INFO ] 2022-10-05 13:18:51.233 ServerManager:62 - Appium server started
[INFO ] 2022-10-05 13:18:51.290 DriverManager:42 - initializing Appium driver
[INFO ] 2022-10-05 13:18:51.323 PropertyManager:31 - loading config properties
[INFO ] 2022-10-05 13:18:51.325 CapabilitiesManager:33 - getting capabilities
[INFO ] 2022-10-05 13:18:51.330 CapabilitiesManager:58 - appUrl is C:\AppiumPOC\src\test\resources\app\AS.apk
[Utils] [ERROR] [Error] java.lang.NullPointerException
        at com.appium.runners.RunnerBase.scenarios(RunnerBase.java:87)
        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:133)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:77)
        at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:46)
        at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:146)
        at org.testng.internal.Parameters.handleParameters(Parameters.java:798)
        at org.testng.internal.Parameters.handleParameters(Parameters.java:740)
        at org.testng.internal.ParameterHandler.handleParameters(ParameterHandler.java:59)
        at org.testng.internal.ParameterHandler.createParameters(ParameterHandler.java:38)
        at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:791)
        at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
        at java.util.ArrayList.forEach(ArrayList.java:1259)
        at org.testng.TestRunner.privateRun(TestRunner.java:794)
        at org.testng.TestRunner.run(TestRunner.java:596)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332)
        at org.testng.SuiteRunner.run(SuiteRunner.java:276)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
        at org.testng.TestNG.runSuites(TestNG.java:1063)
        at org.testng.TestNG.run(TestNG.java:1031)
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:284)
        at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
        at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:119)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)

[ERROR] Tests run: 3, Failures: 2, Errors: 0, Skipped: 1, Time elapsed: 45.537 s <<< FAILURE! - in TestSuite
[ERROR] com.appium.runners.TestNGRunner_Pixel3.setUpClass[Android, emulator-5554, Pixel 4 API 3O, 10000, 11000, iOS, iOS](0)  Time elapsed: 45.308 s  <<
< FAILURE!
org.openqa.selenium.SessionNotCreatedException:
Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while process
ing the command. Original error: Cannot start the 'es.mmip.prisacom.as' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-
running-appium/android/activity-startup.md for troubleshooting. Original error: 'es.sdos.splash.ui.SplashActivity' or 'es.mmip.prisacom.as.es.sdos.splas
h.ui.SplashActivity' never started. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for tr
oubleshooting
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'HL-013080', ip: '192.168.2.64', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_301'
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'es.mmip.prisacom.
as' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Orig
inal error: 'es.sdos.splash.ui.SplashActivity' or 'es.mmip.prisacom.as.es.sdos.splash.ui.SplashActivity' never started. Visit https://github.com/appium/
appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting
    at getResponseForW3CError (C:\Users\rteresa\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
    at asyncHandler (C:\Users\rteresa\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:380:37)

Solution

Problem could be with emulators itself. Try changing OS or Emulator Device Model.

Answered By – Rakesh K

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published