Original error: A new session could not be created

im writing a test for Android app. But in this ap some pages are webview

@Test
@DisplayName(“DAF-T14 Check feedback form after clicking it from profile page”)
public void ProfileAppFeedbackFlow() throws Exception {
String expectedFeedbackTitle = “Feedback”;
String expectedFeedbackWebTitle = “What are your experiences with the DKV app?”;

    var profilePage = new NavigationBar().clickProfileButton();
    Thread.sleep(100);
    scrollDown(0.8, 0.1, 0.5, 2000);
    var feedbackProfilePage = profilePage.clickFeedbackButton();
    Assertions.assertEquals(feedbackProfilePage.getFeedbackTittle(), expectedFeedbackTitle);
    Thread.sleep(3000);


    Set<String> contextHandles = ((AndroidDriver) AppiumInit.getAppiumDriver()).getContextHandles();
    for (String contextHandle : contextHandles){
        System.out.println(contextHandle);
    }

    ((AndroidDriver) AppiumInit.getAppiumDriver()).context("WEBVIEW_com.dkveuroservice.mobileappkit");

    String currentContext = ((AndroidDriver) AppiumInit.getAppiumDriver()).getContext();
    System.out.println("Current Context: " + currentContext);


    Thread.sleep(3000);
    Assertions.assertEquals(feedbackProfilePage.getFeedbackWebTitl(), expectedFeedbackWebTitle);
}

but I got this error:

io.appium.java_client.NoSuchContextException: An unknown server-side error occurred while processing the command. Original error: A new session could not be created. Details: session not created: please close ‘com.dkveuroservice.mobileappkit’ and try again
Build info: version: ‘4.10.0’, revision: ‘c14d967899’
System info: os.name: ‘Mac OS X’, os.arch: ‘aarch64’, os.version: ‘13.5.1’, java.version: ‘17.0.6’
Driver info: io.appium.java_client.android.AndroidDriver
Command: [990d8416-e8f3-43d1-b441-9ae863167667, switchToContext {name=WEBVIEW_com.dkveuroservice.mobileappkit}]
Capabilities {appium:app: //Users//nifargo//Documents…, appium:appPackage: com.dkveuroservice.mobileap…, appium:automationName: UiAutomator2, appium:chromedriver_autodownload: true, appium:databaseEnabled: false, appium:desired: {app: //Users//nifargo//Documents…, automationName: UiAutomator2, chromedriver_autodownload: true, deviceName: autoTests, newCommandTimeout: 500, platformName: ANDROID}, appium:deviceApiLevel: 33, appium:deviceManufacturer: Google, appium:deviceModel: sdk_gphone64_arm64, appium:deviceName: emulator-5554, appium:deviceScreenDensity: 560, appium:deviceScreenSize: 1440x2560, appium:deviceUDID: emulator-5554, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 500, appium:pixelRatio: 3.5, appium:platformVersion: 13, appium:statBarHeight: 84, appium:takesScreenshot: true, appium:viewportRect: {height: 2392, left: 0, top: 84, width: 1440}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID}
Session ID: 990d8416-e8f3-43d1-b441-9ae863167667

so the problem is here - ((AndroidDriver) AppiumInit.getAppiumDriver()).context(“WEBVIEW_com.dkveuroservice.mobileappkit”);

but i dont know what exactly i did wrong

possibly this not correct name of context you have.
Try to make it more dynamic. Make function that will switch to webview while iterating context handles. First approach switch to whatever first contains WEBVIEW. Also check how many WebViews you have! Sometimes app may have 2 or more views and you need to choose correct :slight_smile:

actually i did it with this code

    Set<String> strcontext = null;
    try{
        strcontext = ((AndroidDriver) AppiumInit.getAppiumDriver()).getContextHandles();
        System.out.println("Context name" + strcontext.toString());
        for (String s :strcontext){
            if (s.contains("WEBVIEW")){
                ((AndroidDriver) AppiumInit.getAppiumDriver()).context(s);
                System.out.println("Context is ->" + s);
            }
        }
    } catch (Exception e){
        e.printStackTrace();
    }

But I got the same error
o and by the way I catch webview name with this code - System.out.println(contextHandle);
and here is a list of context:
NATIVE_APP
WEBVIEW_com.dkveuroservice.mobileappkit

ok. now check on this screen that you can connect to your WebView with Chrome debugger from computer. Possibly your webView not debuggable :slight_smile: and you need ask dev to enable webview debug with test app. -> https://developer.chrome.com/docs/devtools/remote-debugging/webviews/

chrome://inspect = yes exactly here i can see my app page and I’m using it for getting XPath
but still have this error

here is my caps:

public void configureAndroidDriver() {
// Android Local configuration
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “Android”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “autoTests”);
capabilities.setCapability(MobileCapabilityType.APP, “//Users//nifargo//Documents//DkvProject//web-app-framework-qa-ui-tests//src//test//resources//androidReleaseBuild.apk”);
capabilities.setCapability(“automationName”, “UiAutomator2”);
capabilities.setCapability(“chromedriver_autodownload”, true);
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 500);
String ipAddress = new Properties().getProperty(“ipAddress”);

    AndroidDriver androidDriver = new AndroidDriver(new AppiumServiceBuilder().withIPAddress(ipAddress), capabilities);
    androidDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
    appiumDriverMap.put(Thread.currentThread().getId(), androidDriver);

also here is my Webview version: ‘Chrome/103.0.5060.71’ and ChromeDriver version: ‘103.0.5060.134’

BTW in many cases you do not need switch to WebView to tap any element :slight_smile:

try also to add

capabilities.setCapability("enableMultiWindows", true);

plus check https://github.com/appium/appium-uiautomator2-driver#web-context
appium:autoWebview + appium:autoWebviewName - maybe helps …

should be like:

for (String s :strcontext){
            if (s.contains("WEBVIEW")){
                System.out.println("Context is ->" + s);
                ((AndroidDriver) AppiumInit.getAppiumDriver()).context(s);
                break; // no need to interact more
            }
        }

okay here is my new code -

@Test
@DisplayName("DAF-T14 Check feedback form after clicking it from profile page")
public void ProfileAppFeedbackFlow() throws Exception {
    String expectedFeedbackTitle = "Feedback";
    String expectedFeedbackWebTitle = "What are your experiences with the DKV app?";

    var profilePage = new NavigationBar().clickProfileButton();
    Thread.sleep(100);
    scrollDown(0.8, 0.1, 0.5, 2000);
    var feedbackProfilePage = profilePage.clickFeedbackButton();
    Assertions.assertEquals(feedbackProfilePage.getFeedbackTittle(), expectedFeedbackTitle);
    Thread.sleep(3000);


    Set<String> strcontext = null;
    try{
        strcontext = ((AndroidDriver) AppiumInit.getAppiumDriver()).getContextHandles();
        System.out.println("Context name" + strcontext.toString());
        for (String s :strcontext){
            if (s.contains("WEBVIEW")){
                ((AndroidDriver) AppiumInit.getAppiumDriver()).context(s);
                break;
            }
        }
    } catch (Exception e){
        e.printStackTrace();
    }

    String currentContext = ((AndroidDriver) AppiumInit.getAppiumDriver()).getContext();
    System.out.println("Current Context: " + currentContext);


    Thread.sleep(3000);
    Assertions.assertEquals(feedbackProfilePage.getFeedbackWebTitl(), expectedFeedbackWebTitle);
}

}

So as we can see I’m switching to Webview context with this code - ((AndroidDriver) AppiumInit.getAppiumDriver()).context(s); and after that I checking exact context with this code -

String currentContext = ((AndroidDriver) AppiumInit.getAppiumDriver()).getContext();
System.out.println("Current Context: " + currentContext);

But I got Current Context: NATIVE_APP. And now we know the problem with switching to webview context. So how can I fix it?

And yes I changed caps:

    // Android Local configuration
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "autoTests");
    capabilities.setCapability(MobileCapabilityType.APP, "//Users//nifargo//Documents//DkvProject//web-app-framework-qa-ui-tests//src//test//resources//androidReleaseBuild.apk");
    capabilities.setCapability("automationName", "UiAutomator2");
    capabilities.setCapability("chromedriver_autodownload", true);
    capabilities.setCapability("enableMultiWindows", true);
    capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 500);
    String ipAddress = new Properties().getProperty("ipAddress");

    AndroidDriver androidDriver = new AndroidDriver(new AppiumServiceBuilder().withIPAddress(ipAddress), capabilities);
    androidDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
    appiumDriverMap.put(Thread.currentThread().getId(), androidDriver);

add more logs to clear issue:

        strcontext = ((AndroidDriver) AppiumInit.getAppiumDriver()).getContextHandles();
        System.out.println("Found contexts size: '" + strcontext.size + "'");
        for (String s :strcontext) {
            System.out.println("Found context: '" + s + "'");
            if (s.contains("WEBVIEW")) {
                System.out.println("Switching context to: '" + s + "'");
                ((AndroidDriver) AppiumInit.getAppiumDriver()).context(s);
                break;
            }
        }

Found contexts size: ‘2’
Found context: ‘NATIVE_APP’
Found context: ‘WEBVIEW_com.dkveuroservice.mobileappkit’
Switching context to: ‘WEBVIEW_com.dkveuroservice.mobileappkit’
io.appium.java_client.NoSuchContextException: An unknown server-side error occurred while processing the command. Original error: A new session could not be created. Details: session not created: please close ‘com.dkveuroservice.mobileappkit’ and try again
Build info: version: ‘4.10.0’, revision: ‘c14d967899’
System info: os.name: ‘Mac OS X’, os.arch: ‘aarch64’, os.version: ‘13.5.1’, java.version: ‘17.0.6’
Driver info: io.appium.java_client.android.AndroidDriver
Command: [627ae2cd-6b9b-41df-bf34-0acd2ebd12f4, switchToContext {name=WEBVIEW_com.dkveuroservice.mobileappkit}]
Capabilities {appium:app: //Users//nifargo//Documents…, appium:appPackage: com.dkveuroservice.mobileap…, appium:automationName: UiAutomator2, appium:chromedriver_autodownload: true, appium:databaseEnabled: false, appium:desired: {app: //Users//nifargo//Documents…, automationName: UiAutomator2, chromedriver_autodownload: true, deviceName: autoTests, enableMultiWindows: true, newCommandTimeout: 500, platformName: ANDROID}, appium:deviceApiLevel: 33, appium:deviceManufacturer: Google, appium:deviceModel: sdk_gphone64_arm64, appium:deviceName: emulator-5554, appium:deviceScreenDensity: 560, appium:deviceScreenSize: 1440x2560, appium:deviceUDID: emulator-5554, appium:enableMultiWindows: true, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 500, appium:pixelRatio: 3.5, appium:platformVersion: 13, appium:statBarHeight: 84, appium:takesScreenshot: true, appium:viewportRect: {height: 2392, left: 0, top: 84, width: 1440}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID}
Session ID: 627ae2cd-6b9b-41df-bf34-0acd2ebd12f4
at io.appium.java_client.remote.SupportsContextSwitching.context(SupportsContextSwitching.java:48)
at org.dkvProject.profilePageProject.ProfilePageTest.ProfileAppFeedbackFlow(ProfilePageTest.java:92)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: A new session could not be created. Details: session not created: please close ‘com.dkveuroservice.mobileappkit’ and try again
Build info: version: ‘4.10.0’, revision: ‘c14d967899’
System info: os.name: ‘Mac OS X’, os.arch: ‘aarch64’, os.version: ‘13.5.1’, java.version: ‘17.0.6’
Driver info: io.appium.java_client.android.AndroidDriver
Command: [627ae2cd-6b9b-41df-bf34-0acd2ebd12f4, switchToContext {name=WEBVIEW_com.dkveuroservice.mobileappkit}]
Capabilities {appium:app: //Users//nifargo//Documents…, appium:appPackage: com.dkveuroservice.mobileap…, appium:automationName: UiAutomator2, appium:chromedriver_autodownload: true, appium:databaseEnabled: false, appium:desired: {app: //Users//nifargo//Documents…, automationName: UiAutomator2, chromedriver_autodownload: true, deviceName: autoTests, enableMultiWindows: true, newCommandTimeout: 500, platformName: ANDROID}, appium:deviceApiLevel: 33, appium:deviceManufacturer: Google, appium:deviceModel: sdk_gphone64_arm64, appium:deviceName: emulator-5554, appium:deviceScreenDensity: 560, appium:deviceScreenSize: 1440x2560, appium:deviceUDID: emulator-5554, appium:enableMultiWindows: true, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 500, appium:pixelRatio: 3.5, appium:platformVersion: 13, appium:statBarHeight: 84, appium:takesScreenshot: true, appium:viewportRect: {height: 2392, left: 0, top: 84, width: 1440}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID}
Session ID: 627ae2cd-6b9b-41df-bf34-0acd2ebd12f4
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:199)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:132)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:51)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:191)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:531)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:590)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:308)
at io.appium.java_client.remote.SupportsContextSwitching.context(SupportsContextSwitching.java:45)
… 71 more
Current Context: NATIVE_APP

org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.
For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Build info: version: ‘4.10.0’, revision: ‘c14d967899’
System info: os.name: ‘Mac OS X’, os.arch: ‘aarch64’, os.version: ‘13.5.1’, java.version: ‘17.0.6’
Driver info: io.appium.java_client.android.AndroidDriver
Command: [627ae2cd-6b9b-41df-bf34-0acd2ebd12f4, findElement {using=xpath, value=//span[@id=‘title’]}]
Capabilities {appium:app: //Users//nifargo//Documents…, appium:appPackage: com.dkveuroservice.mobileap…, appium:automationName: UiAutomator2, appium:chromedriver_autodownload: true, appium:databaseEnabled: false, appium:desired: {app: //Users//nifargo//Documents…, automationName: UiAutomator2, chromedriver_autodownload: true, deviceName: autoTests, enableMultiWindows: true, newCommandTimeout: 500, platformName: ANDROID}, appium:deviceApiLevel: 33, appium:deviceManufacturer: Google, appium:deviceModel: sdk_gphone64_arm64, appium:deviceName: emulator-5554, appium:deviceScreenDensity: 560, appium:deviceScreenSize: 1440x2560, appium:deviceUDID: emulator-5554, appium:enableMultiWindows: true, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 500, appium:pixelRatio: 3.5, appium:platformVersion: 13, appium:statBarHeight: 84, appium:takesScreenshot: true, appium:viewportRect: {height: 2392, left: 0, top: 84, width: 1440}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID}
Session ID: 627ae2cd-6b9b-41df-bf34-0acd2ebd12f4

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:199)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:132)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:51)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:191)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:531)
at org.openqa.selenium.remote.ElementLocation$ElementFinder$2.findElement(ElementLocation.java:165)
at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:59)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:350)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
at org.dkv.feedbackMenuForm.FeedbackProfilePage.getFeedbackWebTitl(FeedbackProfilePage.java:13)
at org.dkvProject.profilePageProject.ProfilePageTest.ProfileAppFeedbackFlow(ProfilePageTest.java:109)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

enable debug appium logs. share result at https://gist.github.com/

it should help to find reason there …

you are with emulator… not real device…

how can i enable debug appium logs?

how you start appium?
I start with plain command in terminal just using java code. like:

appium --log-level error --port 6009 --keep-alive-timeout 1800 --session-override --log-timestamp --tmp /Users/xxx/Documents/appium_logs/ios --use-plugins execute-driver --relaxed-security

and in mine case just replace error -> debug

okay i created and store the result here - https://gist.github.com/Nifargo/868897094dacb4b89a77eac3b124503d

yes im with emulator

Welcome to Appium v2.0.0-rc.5

eee why not increase it version to latest?

see

2023-10-03 16:14:31:488 [AndroidUiautomator2Driver@0d1e] The following capabilities were provided, but are not recognized by Appium:
2023-10-03 16:14:31:488 [AndroidUiautomator2Driver@0d1e]   chromedriver_autodownload
2023-10-03 16:14:31:488 [AndroidUiautomator2Driver@0d1e]   deviceName
2023-10-03 16:14:31:488 [AndroidUiautomator2Driver@0d1e]   enableMultiWindows

and below

2023-10-03 16:15:06:214 [AndroidUiautomator2Driver@0d1e (443b77e0)] Automated Chromedriver download is disabled. Use 'chromedriver_autodownload' server feature to enable it
...
Found 1 Chromedriver, which is missing in the list of known versions: {"103.0.5060.24":"103"}
...
2023-10-03 16:15:06:511 [Chromedriver@3023] Proxying [POST /session] to [POST http://127.0.0.1:8000/session] with body: {"capabilities":{"alwaysMatch":{"goog:chromeOptions":{"androidPackage":"com.dkveuroservice.mobileappkit.staging","androidUseRunningApp":true,"androidProcess":"com.dkveuroservice.mobileappkit","androidDeviceSerial":"emulator-5554"},"goog:loggingPrefs":{"browser":"ALL"}}}}
2023-10-03 16:15:06:620 [Chromedriver@3023] Webview version: 'Chrome/103.0.5060.71'
2023-10-03 16:15:06:621 [Chromedriver@3023] Got response with status 500: {"value":{"error":"session not created","message":"session not created: please close 'com.dkveuroservice.mobileappkit' and try again","stacktrace":"0   chromedriver_mac64_m1_v103.0.5060.1 0x0000000103391d60 chromedriver_mac64_m1_v103.0.5060.1 + 3792224\n1   chromedriver_mac64_m1_v103.0.5060.1 0x0000000103328874 chromedriver_mac64_m1_v103.0.5060.1 + 3360884\n2   chromedriver_mac64_m1_v103.0.5060.1 0x0000000103029184 chromedriver_mac64_m1_v103.0.5060.1 + 217476\n3   chromedriver_mac64_m1_v103.0.5060.1 0x000000010304bdac chromedriver_mac64_m1_v103.0.5060.1 + 359852\n4   chromedriver_mac64_m1_v103.0.5060.1 0x0000000103046100 chromedriver_mac64_m1_v103.0.5060.1 + 336128\n5   chromedriver_mac64_m1_v103.0.5060.1 0x0000000103076140 chromedriver_mac64_m1_v103.0.5060.1 + 532800\n6   chromedriver_mac64_m1_v103.0.5060.1 0x000000010304e3e4 chromedriver_mac64_m1_v103.0.5060.1 + 369636\n7   chromedriver_mac64_m1_v103.0.5060.1 0x0000000103367234 chromedriver_mac64_m1_v103.0.5060.1 + 3617332\n8   chromedriver_mac64_m1_v103...

okay now i have Welcome to Appium v2.1.3

but as you can see from my caps:
// Android Local configuration
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “Android”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “autoTests”);
capabilities.setCapability(MobileCapabilityType.APP, “//Users//nifargo//Documents//DkvProject//web-app-framework-qa-ui-tests//src//test//resources//androidReleaseBuild.apk”);
capabilities.setCapability(“automationName”, “UiAutomator2”);
capabilities.setCapability(“chromedriver_autodownload”, true);
capabilities.setCapability(“enableMultiWindows”, true);
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 500);
String ipAddress = new Properties().getProperty(“ipAddress”);

    AndroidDriver androidDriver = new AndroidDriver(new AppiumServiceBuilder().withIPAddress(ipAddress), capabilities);
    androidDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
    appiumDriverMap.put(Thread.currentThread().getId(), androidDriver);

I put chromedriver_autodownload to true.

--relaxed-security --allow-insecure chromedriver_autodownload - this is Appium server flag NOT driver capabilities

see error text

Use 'chromedriver_autodownload' server feature to enable it

oi and this is Settings now. Not driver capability. GitHub - appium/appium-uiautomator2-driver: Appium driver for Android UIAutomator2

you can set it e.g. after driver opened

driver.setSetting("enableMultiWindows", true);