Skip to content

type: special characters (e.g. @ in email) don't land; standalone type treats text as an element selector #1

Description

@yassiEmp

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions