type

in Japanese(日本語)

Types text into a field, either the currently focused one or a specified element.

Functions

function description
type("some text", replace: false, settle:) Types into the currently focused element (focus it first with tap(inputField)). The argument is text, not a selector — passing something that looks like a selector (a single word of # followed only by ASCII letters, digits, _ or -, or text containing || / >>) fails before execution rather than silently typing the literal string. To actually type such a string, use the two-argument form type("#field", "#email"). replace: true clears the field (like clearInput) before typing. It reads the field back after typing and fixes dropped characters, the same as type(sel, "some text") (when the focused field cannot be told apart in the screen, or it is a password field, it types once without checking).
type(sel, "some text", replace:settle:waitSeconds:scroll:maxSwipes:) Resolves the element, then types into it. Japanese text is typed as-is (no IME switching needed). replace: true clears the field before typing. After clearing, it finds the same field again before typing, and fails without typing if it cannot (so it never types into a different field).
select(sel).type("some text", replace:settle:waitSeconds:) Types into the grabbed element. It resolves the grabbed selector again, so it behaves exactly like type(sel, "some text"). It fails on an element that was not found. Elements found by findImage / findImages cannot be typed into this way (call .tap() first, then type("some text")). To just type, write type(sel, "some text") — select only adds a step.

Example

tap("#field")
type("abc")                        // tap first to focus, then type

type("#email", "test@example.com") // selector form: resolve + focus + type in one step
type("#note", "new contents", replace: true)

let field = select("#login_id")    // only when the grabbed element is used later
field.type("alice")                // same as type("#login_id", "alice")

Notes