Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash When Using Send Keys Endpoint #1033

Open
BenPela opened this issue Dec 9, 2024 · 1 comment
Open

Crash When Using Send Keys Endpoint #1033

BenPela opened this issue Dec 9, 2024 · 1 comment

Comments

@BenPela
Copy link

BenPela commented Dec 9, 2024

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?

@cyoung27
Copy link

cyoung27 commented Dec 17, 2024

Just chiming in to say that I started to experience this exact issue last week (same error on setStylusHandwritingEnabled when trying to do sendKeys). Typically it points to mismatches in the dependencies, but even after updating to match I'm getting this same error. Will continue to watch and/or update if we find any solution.

Appium Version: 2.13.1
Appium Espresso Driver Version: 3.5.1 and 3.5.2

"espressoBuildConfig": "{\"toolsVersions\":{\"compileSdk\":\"34\",\"targetSdk\":\"34\",\"gradle\":\"8.7\",\"androidGradlePlugin\":\"8.5.1\",\"buildTools\":\"34.0.0\",\"minSdk\":\"26\",\"kotlin\":\"2.0.0\",\"composeVersion\":\"1.7.4\",\"espressoVersion\":\"3.5.1\"}}",

    "additionalAppDependencies":"[\"androidx.appcompat:appcompat:1.7.0\"]",

    "additionalAndroidTestDependencies":"[\"androidx.compose.foundation:foundation:1.7.4\", \"androidx.lifecycle:lifecycle-common-java8:2.7.0\", \"androidx.lifecycle:lifecycle-reactivestreams-ktx:2.8.4\", \"androidx.lifecycle:lifecycle-runtime-ktx:2.8.4\", \"androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4\", \"androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4\", \"androidx.lifecycle:lifecycle-livedata-ktx:2.8.4\",\"androidx.activity:activity-compose:1.9.2\",\"androidx.fragment:fragment-ktx:1.6.2\"]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants