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 #2186

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

selenium-java==>4.21.0 java-client ==>9.2.3 appium server ==>v2.10.3 Desktop OS/version used to run Appium: Microsoft Windows Server 2022 Standard(10.0.20348 Build 20348) Node.js version: v20.14.0 Mobile platform/version under test: Android 14 Real device: Samsung Galaxy S21 FE 5G

Details

[ERROR]  AndroidChromeTest.setUp:31 » SessionNotCreated Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Appium Settings app is not running after 5000ms 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 {appium:automationName: UIAutomator2, browserName: chrome, browserVersion: 125, goog:chromeOptions: {androidDeviceSerial: R5CW71PYTHE, args: [], extensions: []}, platformName: ANDROID}]}] Capabilities {appium:automationName: UIAutomator2, browserName: chrome, browserVersion: 125, goog:chromeOptions: {androidDeviceSerial: R5CW71PYTHE, args: [], extensions: []}, platformName: ANDROID}

Code To Reproduce Issue

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.AutomationName;

public class AndroidChromeTest {
    WebDriver driver;

    @BeforeMethod
    public void setUp() throws MalformedURLException {
        ChromeOptions options = new ChromeOptions();
//      AppiumOptions options = new AppiumOptions();
        URL url = new URL("http://localhost:4723/");
        options.setPlatformName("Android");
        options.setAndroidDeviceSerialNumber("R5CW71PYTHE");
        options.setBrowserVersion("125");
        options.setCapability("appium:automationName",AutomationName.ANDROID_UIAUTOMATOR2);
//      options.setCapability("automationName","UIAutomator2");
        driver = new AndroidDriver(url, options);
    }

    @Test
    public void verifyTitle() throws MalformedURLException {
        driver.get("https://home.zcommerceqa.zekelman.com/zekelmanstorefront/home/en/USD/login");
        Assert.assertEquals(driver.getTitle(), "Login | Z-Commerce");
    }
}

Exception Stacktraces

[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 10.73 s <<< FAILURE! -- in com.zk.mobile.device.test.AndroidChromeTest
[ERROR] com.zk.mobile.device.test.AndroidChromeTest.setUp -- Time elapsed: 10.66 s <<< FAILURE!
org.openqa.selenium.SessionNotCreatedException: 
Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Appium Settings app is not running after 5000ms 
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 {appium:automationName: UIAutomator2, browserName: chrome, browserVersion: 125, goog:chromeOptions: {androidDeviceSerial: R5CW71PYTHE, args: [], extensions: []}, platformName: ANDROID}]}]
Capabilities {appium:automationName: UIAutomator2, browserName: chrome, browserVersion: 125, goog:chromeOptions: {androidDeviceSerial: R5CW71PYTHE, 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:31)
    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 Console Logs.txt

vnuta9 commented 3 months ago

When I go in to Settings-->Apps-->AndroidSettings-->Open-->this pop up shows up image

vnuta9 commented 3 months ago

I could able to resolve the issue by following the answer here

And after that following this suggestion