Problem
Two related issues with type while automating a login form (email + password):
1. Special characters are mangled
agent-droid tap @e5 --then type "owner@seed.com" did not put owner@seed.com into the focused field — the input ended up showing garbage (e.g. a stray 0), and the @ / parts of the string were dropped.
The underlying cause appears to be that type shells out to adb shell input text <text>, which mishandles characters like @ unless they're escaped (input text 'owner\@seed.com' works). Spaces, &, (, ), <, >, ;, |, ', " have the same class of problem.
Workaround currently needed: drop to raw adb with manual escaping:
adb shell input text 'owner\@seed.com'
2. Standalone type is ambiguous with element selectors
agent-droid type "owner@seed.com" (without a preceding --then) fails with:
agent-droid error: No element matching "owner@seed.com". Run `droid snapshot` to see what's on screen.
i.e. the bare positional argument is interpreted as an element ref/target to find, not as text to type. It only works when chained as tap @eN --then type "...".
Suggested fix
- Escape the text for
adb input text (replace spaces with %s and backslash-escape shell/input-special characters: `@ & ( ) < > ; | ' " `` space etc.), or send it via base64/keyevent fallback for full Unicode.
- Make
type accept text unambiguously (e.g. require --text, or only treat a leading @ref as a target and the rest as literal text), so type "free text" works standalone.
Environment
- Windows host, Samsung physical device (R38M6063PXE), Android.
Problem
Two related issues with
typewhile automating a login form (email + password):1. Special characters are mangled
agent-droid tap @e5 --then type "owner@seed.com"did not putowner@seed.cominto the focused field — the input ended up showing garbage (e.g. a stray0), and the@/ parts of the string were dropped.The underlying cause appears to be that
typeshells out toadb shell input text <text>, which mishandles characters like@unless they're escaped (input text 'owner\@seed.com'works). Spaces,&,(,),<,>,;,|,',"have the same class of problem.Workaround currently needed: drop to raw adb with manual escaping:
2. Standalone
typeis ambiguous with element selectorsagent-droid type "owner@seed.com"(without a preceding--then) fails with:i.e. the bare positional argument is interpreted as an element ref/target to find, not as text to type. It only works when chained as
tap @eN --then type "...".Suggested fix
adb input text(replace spaces with%sand backslash-escape shell/input-special characters: `@ & ( ) < > ; | ' " `` space etc.), or send it via base64/keyevent fallback for full Unicode.typeaccept text unambiguously (e.g. require--text, or only treat a leading@refas a target and the rest as literal text), sotype "free text"works standalone.Environment