Appium "send_keys" method is not working

:backhand_index_pointing_right: Bug Description


1. Summary

I am trying to do automated test on an application, using Appium. I can locate the search element using find_element method. However send_keys method is not doing anything.

Bug Severity
Select one that applies

  • Impacts operation of app
  • Blocks current development
  • Improvement suggestion
  • Issue with documentation (If selected, please share the doc link and describe the issue)
  • Other

2. Steps to Reproduce

  1. Python script to connect to driver and find element of the search box and .send_keys("blabla")

3. Observed Behavior

Explain what actually happened, noting any discrepancies or malfunctions.

Method did not return or thrown any errors. Script just ended successfully.

4. Expected Behavior

Describe what you expected the SDK to do under normal operation.

Expected to write the keys on the screen search box

4.a Possible Root Cause & Temporary Workaround

Thought that the element was wrong, but confirmed that it was correct with Appium inspector.

5. Logs or crash report

No crashes, no exceptions.

APPIUM LOG:
Running /element with strategy=UiSelector, selector={β€œargs”:{ β€œrole”: β€œedit” }}
Sending jsonRPC POST http://127.0.0.1:15970/jsonrpc id=0, method=findObjects, params object={β€œargs”:{β€œrole”:β€œedit”},β€œselectorStrategy”:β€œUiSelector”}
received jsonrpc response in 441ms (http 200 OK): {β€œid”:β€œ0”,β€œjsonrpc”:β€œ2.0”,β€œresult”:[158913791613]}
[KeplerDriver@6d1b] Responding to client with driver.findElement() result: {β€œELEMENT”:β€œ158913791613”,β€œelement-6066-11e4-a52e-4f735466cecf”:β€œ158913791613”}
[HTTP] ← POST /session/0a8779ab-3685-41d1-a7da-cb138c4b6344/element 200 442 ms - 89
[HTTP] β†’ POST /session/0a8779ab-3685-41d1-a7da-cb138c4b6344/element/158913791613/value {β€œtext”:β€œthe quick brown fox”,β€œvalue”:[β€œt”,β€œh”,β€œe”," β€œ,β€œq”,β€œu”,β€œi”,β€œc”,β€œk”,” β€œ,β€œb”,β€œr”,β€œo”,β€œw”,β€œn”,” β€œ,β€œf”,β€œo”,β€œx”]}
[KeplerDriver@6d1b] Calling AppiumDriver.setValue() with args: [[β€œt”,β€œh”,β€œe”,” β€œ,β€œq”,β€œu”,β€œi”,β€œc”,β€œk”,” β€œ,β€œb”,β€œr”,β€œo”,β€œw”,β€œn”,” ",β€œf”,β€œo”,β€œx”],β€œ158913791613”,β€œ0a8779ab-3685-41d1-a7da-cb138c4b6344”]
Running /executeScript with script=setValue, args=[
[
β€˜t’, β€˜h’,
β€˜e’, ’ ',
β€˜q’, β€˜u’,
β€˜i’, β€˜c’,
β€˜k’, ’ ',
β€˜b’, β€˜r’,
β€˜o’, β€˜w’,
β€˜n’, ’ ',
β€˜f’, β€˜o’,
β€˜x’, [length]: 19
],
β€˜158913791613’,
β€˜0a8779ab-3685-41d1-a7da-cb138c4b6344’,
[length]: 3
]
Running /element/158913791613/value with keys=[
β€˜t’, β€˜h’, β€˜e’, ’ ', β€˜q’,
β€˜u’, β€˜i’, β€˜c’, β€˜k’, ’ ',
β€˜b’, β€˜r’, β€˜o’, β€˜w’, β€˜n’,
’ ', β€˜f’, β€˜o’, β€˜x’
]
Sending jsonRPC POST http://127.0.0.1:15970/jsonrpc id=0, method=setText, params object={β€œid”:158913791613,β€œtext”:β€œthe quick brown fox”}
received jsonrpc response in 194ms (http 200 OK): {β€œid”:β€œ0”,β€œjsonrpc”:β€œ2.0”,β€œresult”:false}

6. Environment

Please fill out the fields related to your bug below:

  • SDK Version: v0.22

  • App State: Foreground

  • OS Information:

    NAME="OS"
    OE_VERSION="4.0.0"
    OS_MAJOR_VERSION="1"
    OS_MINOR_VERSION="1"
    RELEASE_ID="14"
    OS_VERSION="1.1"
    BRANCH_CODE="TV Ship day60"
    BUILD_DESC="OS 1.1 (TV Ship day60/91)"
    BUILD_FINGERPRINT="4.0.216859.0(3072cab629675a74)/91N:user/release-keys"
    BUILD_VARIANT="user"
    BUILD_TAGS="release-keys"
    BUILD_DATE="Wed Jan 28 22:43:49 UTC 2026"
    BUILD_TIMESTAMP="1769640229"
    VERSION_NUMBER="1401010009120"
    

7. Example Code Snippet / Screenshots / Screengrabs

Include any relevant code or component setup in React Native that can help reproduce the bug.

device_serial = "192.168.1.21:5555"
desired_caps = {     "platformName": "Kepler",     "appium:automationName": "automation-toolkit/JSON-RPC",     "kepler:device": f"vda://{device_serial}"}
def appium_session():    appium_options = AppiumOptions()    appium_options.load_capabilities(desired_caps)    driver = webdriver.Remote('http://127.0.0.1:44557', options=appium_options)    return driver
d = appium_session()
#Display already on the correct screen
editableEle = d.find_element("UiSelector", '{"args":{ "role": "edit" }}')
editableEle.send_keys("the quick brown fox")

Hi @Sukhbat,

Welcome to Amazon Developer Community!!

Thank you for reporting this issue. The send_keys() method is currently not working due to the setText JSON-RPC call returning false.

Workaround

Use injectInputKeyEvent: Based on fixes for related issues, try using the JSON-RPC method directly:

# 1. Focus the element first
editableEle = d.find_element("UiSelector", '{"args":{ "role": "edit" }}')
editableEle.click()
time.sleep(0.5)  # Give it time to focus

# 2. Send text character by character using key events
text = "the quick brown fox"
for char in text:
    if char == ' ':
        # Space key (keycode 62)
        d.execute_script("jsonrpc: injectInputKeyEvent",
                        [{"inputKeyEvent": "62", "holdDuration": 100}])
    else:
        # For alphanumeric characters, you may need to map to keycodes
        # Or try the mobile: type command
        d.execute_script("mobile: type", [{"text": char}])
    time.sleep(0.05)  # Small delay between characters

Verify Element State: Ensure the element is ready to receive input:

editableEle = d.find_element("UiSelector", '{"args":{ "role": "edit" }}')
editableEle.click()
time.sleep(0.5)

# Check if element is enabled and ready
print(f"Element enabled: {editableEle.is_enabled()}")
print(f"Element displayed: {editableEle.is_displayed()}")

Could you please try out these workarounds and let us know if they resolve your issue?

Feel free to reach back to me if you have any questions!

Thanks for helping us improve the Vega platform.

Warm regards,
Aishwarya

This is the exception on command d.execute_script("mobile: type", [{"text": char}])
Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot execute β€˜mobile: type’. Only commands that begin with 'jsonrpc: ’ or 'shell: ’ are supported.
at getResponseForW3CError (/opt/homebrew/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/errors.js:1143:9)
at asyncHandler (/opt/homebrew/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:487:57)

ALSO:

Tried using command injectInputKeyEvent like this to type just one letter β€œA”. Did not work.

d.execute_script("jsonrpc: injectInputKeyEvent",[{"inputKeyEvent": 30 , "holdDuration": 100 }])

image

Hi @Sukhbat,

Thank you for trying out the workarounds and providing the detailed error information!

From the documentation https://developer.amazon.com/docs/vega/0.21/appium-commands.html, our team has prepared a simple Appium script where we are waiting for the keyboard to be available before typing, and it is working as expected.

Script: appium_search_test.py (4.5 KB)

Please add a small wait for the keyboard to be available before typing.

This approach follows the official documentation which states: β€œsend_keys doesn’t open or close the keyboard automatically. To open the keyboard, click any editable item.”

Let us know if this resolves your issue!

Warm regards,
Aishwarya

Thank you.
Is there any programmatic way to know if keyboard is available or not?

Hi @Sukhbat,

Programmatic Keyboard Detection for Appium on Vega

To detect keyboard availability, use driver.page_source to check for "Keyboard Layer" in the UI tree. The solution polls every 0.5 seconds with a 10-second timeout.

Implementation approach:

  • Click the editable element to trigger keyboard
  • Poll page_source for β€œKeyboard Layer” string
  • Proceed with send_keys() once keyboard is detected

Reference: Appium Commands | Design and Develop Vega Apps

Tested and working as expected. Updated script attached: appium_search_test-1.py (6.4 KB)

Warm regards,
Aishwarya

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.