appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Apache License 2.0
1.21k stars 756 forks source link

[Issue]: Original error: Appium Settings app is not running after 5000ms #2185

Closed vnuta9 closed 3 months ago

vnuta9 commented 3 months ago

Description

I am trying to do a small POC for automating the test cases for a desktop eCommerce website to run on real mobile device(mobileWeb) browser(chrome) using the combination of Selenium and Appium using the latest Eclipse (Version: 2024-06 (4.32.0)) and recent JDK 21.0.3

Environment

Details

[INFO] [INFO] Results: [INFO] [ERROR] Failures:  [ERROR]  AndroidChromeTest.setUp:25 » SessionNotCreated Could not start a new session. Response code 400. Message: 'automationName' can't be blank Host info: host: 'IL02-DEVAPP-D', ip: '10.40.11.31' Build info: version: '4.21.0', revision: '79ed462ef4' System info: os.name: 'Windows Server 2022', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.3' Driver info: io.appium.java_client.android.AndroidDriver Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, platformName: ANDROID}]}] Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, platformName: ANDROID} [INFO] [ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 1

Code To Reproduce Issue [ Good To Have ]

Java Class with code is attached. Rename back to Java file extension. AndroidChromeTest.txt

Exception stack traces

[INFO] Running com.zk.mobile.device.test.AndroidChromeTest
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J(W): Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J(W): Ignoring binding found at [jar:file:/C:/Users/a-venutalapat/.m2/repository/com/browserstack/browserstack-java-sdk/1.12.4/browserstack-java-sdk-1.12.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J(W): See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 0.946 s <<< FAILURE! -- in com.zk.mobile.device.test.AndroidChromeTest
[ERROR] com.zk.mobile.device.test.AndroidChromeTest.setUp -- Time elapsed: 0.866 s <<< FAILURE!
org.openqa.selenium.SessionNotCreatedException: 
Could not start a new session. Response code 400. Message: 'automationName' can't be blank 
Host info: host: 'IL02-DEVAPP-D', ip: '10.40.11.31'
Build info: version: '4.21.0', revision: '79ed462ef4'
System info: os.name: 'Windows Server 2022', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.3'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, platformName: ANDROID}]}]
Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}, platformName: ANDROID}
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:114)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61)
    at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:176)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518)
    at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:270)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:161)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:91)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:103)
    at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:109)
    at com.zk.mobile.device.test.AndroidChromeTest.setUp(AndroidChromeTest.java:25)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
    at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:71)
    at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:400)
    at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:333)
    at org.testng.internal.invokers.TestInvoker.runConfigMethods(TestInvoker.java:833)
    at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:600)
    at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:230)
    at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:63)
    at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:992)
    at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:203)
    at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:154)
    at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:134)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
    at org.testng.TestRunner.privateRun(TestRunner.java:739)
    at org.testng.TestRunner.run(TestRunner.java:614)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:421)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:413)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:373)
    at org.testng.SuiteRunner.run(SuiteRunner.java:312)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1208)
    at org.testng.TestNG.runSuites(TestNG.java:1112)
    at org.testng.TestNG.run(TestNG.java:1079)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:155)
    at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:102)
    at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:91)
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:137)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
    at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)

Link to Appium logs

[Appium] Welcome to Appium v2.10.3
[Appium] The autodetected Appium home path: C:\Users\a-venutalapat\.appium
[Appium] Attempting to load driver uiautomator2...
[Appium] Attempting to load driver xcuitest...
[Appium] Attempting to load driver chromium...
[Appium] Requiring driver at C:\Users\a-venutalapat\.appium\node_modules\appium-uiautomator2-driver\build\index.js
[Appium] Requiring driver at C:\Users\a-venutalapat\.appium\node_modules\appium-xcuitest-driver\build\index.js
[Appium] Requiring driver at C:\Users\a-venutalapat\.appium\node_modules\appium-chromium-driver\index.js
[Appium] AndroidUiautomator2Driver has been successfully loaded in 1.481s
[Appium] XCUITestDriver has been successfully loaded in 1.481s
[Appium] ChromiumDriver has been successfully loaded in 1.481s
[Appium] Attempting to load driver gecko...
[Appium] Requiring driver at C:\Users\a-venutalapat\.appium\node_modules\appium-geckodriver\build\index.js
[Appium] GeckoDriver has been successfully loaded in 0.046s
[Appium] Appium REST http interface listener started on http://0.0.0.0:4723
[Appium] You can provide the following URLs in your client code to connect to this server:
        http://10.40.11.31:4723/
        http://127.0.0.1:4723/ (only accessible from the same host)
[Appium] Available drivers:
[Appium]   - uiautomator2@3.5.5 (automationName 'UiAutomator2')
[Appium]   - xcuitest@7.17.5 (automationName 'XCUITest')
[Appium]   - chromium@1.3.26 (automationName 'Chromium')
[Appium]   - gecko@1.3.6 (automationName 'Gecko')
[Appium] Available plugins:
[Appium]   - execute-driver@3.0.30
[Appium]   - relaxed-caps@1.0.6
[Appium] No plugins activated. Use the --use-plugins flag with names of plugins to activate
[HTTP] Request idempotency key: a2bb8098-1bbc-4398-8168-958d97b415f7
[HTTP] --> POST /wd/hub/session {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":[],"extensions":[]},"platformName":"ANDROID"}]}}
[HTTP] No route found for /wd/hub/session
[HTTP] <-- POST /wd/hub/session 404 8 ms - 211
[HTTP] Request idempotency key: 94e14797-a01e-4424-a0c1-dc0db88449a4
[HTTP] --> POST /session {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":[],"extensions":[]},"platformName":"ANDROID"}]}}
[AppiumDriver@daf5] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":[],"extensions":[]},"platformName":"ANDROID"}]}]
[AppiumDriver@daf5] Event 'newSessionRequested' logged at 1718804372719 (08:39:32 GMT-0500 (Central Daylight Time))
[Appium] Could not parse W3C capabilities: 'automationName' can't be blank
[AppiumDriver@daf5] Event 'newSessionStarted' logged at 1718804372723 (08:39:32 GMT-0500 (Central Daylight Time))
[AppiumDriver@daf5] Encountered internal error running command: InvalidArgumentError: 'automationName' can't be blank

If you are reporting a bug, always include Appium logs as linked gists! It helps to define the problem correctly and clearly. Similar to bug #17779

Dor-bl commented 3 months ago

@mykola-mokhnach @KazuCocoa ,need to move this to Java client repo

vnuta9 commented 3 months ago

@Dor-bl My bad. Would it be moved, or should I re-create it in the Java Client repo ?

Dor-bl commented 3 months ago

You can wait for it to be moved

mykola-mokhnach commented 3 months ago

Probably a duplicate of https://github.com/appium/java-client/issues/2184

vnuta9 commented 3 months ago

My bad. I know the issue now. I have called for the creation of the driver twice. Closing it. Sorry for the trouble caused.