Skip to content

Crash When Using Send Keys Endpoint #1033

@BenPela

Description

@BenPela

Crash When Using Send Keys Endpoint

Appium Version: 2.5.1 and 2.13.1
Appium Espresso Driver Version: 2.44.2 and 3.5.1
Android Simulator Version - Replicated on at least Android APIs 30, 33 and 34
App Used - I've created a minimal app, with a single textfield - https://github.com/BenPela/single-text-field-app

Here are my appium options and python code used to replicate the bug

from appium.webdriver.webdriver import WebDriver
from appium.options.common import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy


options = {
    'platformName': "android",
    'automationName': "espresso",
    'autoLaunch': False,
    'newCommandTimeout': 0,
    'appActivity': "com.example.appiumbugexample.MainActivity",
    'appPackage': "com.example.appiumbugexample",
    'espressoBuildConfig': "{\"toolsVersions\": "
                           "{\"compileSdk\": 34,"
                           "\"minSdk\": 29,"
                           "\"composeVersion\":\"1.7.5\","
                           "\"kotlin\": \"1.9.25\" }, "
                           "\"additionalAndroidTestDependencies\": [\"androidx.annotation:annotation:1.2.0\"] }",
    'forceEspressoRebuild': True,
    'platformVersion': "11",
    'fullReset': True,
    'app': "./app-debug.apk",
}



aoptions = AppiumOptions().load_capabilities(options)
driver = WebDriver("http://localhost:4723", options=aoptions)
driver.update_settings({"driver": "compose"})
driver.activate_app("com.example.appiumbugexample")
element = driver.find_element(by = AppiumBy.ACCESSIBILITY_ID, value="TextField")
element.send_keys("Hello World")

Here is my log from Appium - https://gist.github.com/BenPela/74ec617e3ad768915cd144988df172b4

Key section of error message

[HTTP] --> POST /session/6a1efa52-b150-4f69-8084-4abec67109e7/element/1c47d548-3252-4c83-91bd-59b2a0d67261/value
[HTTP] {"text":"Hello World","value":["H","e","l","l","o"," ","W","o","r","l","d"]}
[EspressoDriver@30c1 (6a1efa52)] Driver proxy active, passing request on via HTTP proxy
[EspressoDriver@30c1 (6a1efa52)] Matched '/session/6a1efa52-b150-4f69-8084-4abec67109e7/element/1c47d548-3252-4c83-91bd-59b2a0d67261/value' to command name 'setValue'
[EspressoDriver@30c1 (6a1efa52)] Proxying [POST /session/6a1efa52-b150-4f69-8084-4abec67109e7/element/1c47d548-3252-4c83-91bd-59b2a0d67261/value] to [POST http://127.0.0.1:8300/session/4e173ea2-0de3-4403-b76f-d18a21a1793f/element/1c47d548-3252-4c83-91bd-59b2a0d67261/value] with body: {"text":"Hello World","value":["H","e","l","l","o"," ","W","o","r","l","d"]}
[EspressoDriver@30c1 (6a1efa52)] [Instrumentation] Process crashed while executing startEspressoServer(io.appium.espressoserver.EspressoServerRunnerTest):
[EspressoDriver@30c1 (6a1efa52)] java.lang.NoSuchMethodError: No static method setStylusHandwritingEnabled(Landroid/view/inputmethod/EditorInfo;Z)V in class Landroidx/core/view/inputmethod/EditorInfoCompat; or its super classes (declaration of 'androidx.core.view.inputmethod.EditorInfoCompat' appears in /data/app/~~zpM-LPdsJUAXBkZGwX9G6A==/io.appium.espressoserver.test-ob01TvuCpSZSU81qFzyhWQ==/base.apk)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.foundation.text.input.internal.EditorInfo_androidKt.update-pLxbY9I(EditorInfo.android.kt:171)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.foundation.text.input.internal.EditorInfo_androidKt.update-pLxbY9I$default(EditorInfo.android.kt:43)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.foundation.text.input.internal.LegacyTextInputMethodRequest.createInputConnection(LegacyPlatformTextInputServiceAdapter.android.kt:264)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.foundation.text.input.internal.LegacyTextInputMethodRequest.createInputConnection(LegacyPlatformTextInputServiceAdapter.android.kt:201)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.platform.InputMethodSession.createInputConnection(AndroidPlatformTextInputSession.android.kt:143)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.platform.AndroidPlatformTextInputSession.createInputConnection(AndroidPlatformTextInputSession.android.kt:107)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.platform.AndroidComposeView.onCreateInputConnection(AndroidComposeView.android.kt:2184)
[EspressoDriver@30c1 (6a1efa52)]        at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:1917)
[EspressoDriver@30c1 (6a1efa52)]        at android.view.inputmethod.InputMethodManager$DelegateImpl.startInput(InputMethodManager.java:585)
[EspressoDriver@30c1 (6a1efa52)]        at android.view.ImeFocusController.checkFocus(ImeFocusController.java:161)
[EspressoDriver@30c1 (6a1efa52)]        at android.view.inputmethod.InputMethodManager.checkFocus(InputMethodManager.java:2069)
[EspressoDriver@30c1 (6a1efa52)]        at android.view.inputmethod.InputMethodManager.restartInput(InputMethodManager.java:1838)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.text.input.InputMethodManagerImpl.restartInput(InputMethodManager.android.kt:76)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.text.input.TextInputServiceAndroid.restartInputImmediately(TextInputServiceAndroid.android.kt:450)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.text.input.TextInputServiceAndroid.processInputCommands(TextInputServiceAndroid.android.kt:343)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.text.input.TextInputServiceAndroid.sendInputCommand$lambda$1(TextInputServiceAndroid.android.kt:264)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.text.input.TextInputServiceAndroid.$r8$lambda$EPVR_TMFA5GOjs4tvuSSub8L5-M(Unknown Source:0)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.text.input.TextInputServiceAndroid$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.text.input.TextInputServiceAndroid_androidKt.asExecutor$lambda$2$lambda$1(TextInputServiceAndroid.android.kt:569)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.text.input.TextInputServiceAndroid_androidKt.$r8$lambda$nEtFUEU03rhWZ7PGABg9OjqaO2E(Unknown Source:0)
[EspressoDriver@30c1 (6a1efa52)]        at androidx.compose.ui.text.input.TextInputServiceAndroid_androidKt$$ExternalSyntheticLambda0.doFrame(D8$$SyntheticClass:0)
[EspressoDriver@30c1 (6a1efa52)]        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970)
[EspressoDriver@30c1 (6a1efa52)]        at android.view.Choreographer.doCallbacks(Choreographer.java:796)
[EspressoDriver@30c1 (6a1efa52)]        at android.view.Choreographer.doFrame(Choreographer.java:727)
[EspressoDriver@30c1 (6a1efa52)]        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
[EspressoDriver@30c1 (6a1efa52)]        at android.os.Handler.handleCallback(Handler.java:938)
[EspressoDriver@30c1 (6a1efa52)]        at android.os.Handler.dispatchMessage(Handler.java:99)
[EspressoDriver@30c1 (6a1efa52)]        at android.os.Looper.loop(Looper.java:223)
[EspressoDriver@30c1 (6a1efa52)]        at android.app.ActivityThread.main(ActivityThread.java:7656)
[EspressoDriver@30c1 (6a1efa52)]        at java.lang.reflect.Method.invoke(Native Method)
[EspressoDriver@30c1 (6a1efa52)]        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
[EspressoDriver@30c1 (6a1efa52)]        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
[EspressoDriver@30c1 (6a1efa52)] socket hang up
[HTTP] <-- POST /session/6a1efa52-b150-4f69-8084-4abec67109e7/element/1c47d548-3252-4c83-91bd-59b2a0d67261/value 400 55 ms - 1166
[HTTP] 
[EspressoDriver@30c1 (6a1efa52)] [Instrumentation] INSTRUMENTATION_RESULT: shortMsg=Process crashed.
[EspressoDriver@30c1 (6a1efa52)] [Instrumentation] INSTRUMENTATION_CODE: 0
[EspressoDriver@30c1 (6a1efa52)] Instrumentation process exited with code 0 from signal null

Any ideas how to fix this, or a good alternative to entering text in fields for now?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions