type() is a client method. Elements don’t have a type() method.
Signature
Parameters
Errors
Throws an error iftext is undefined or null. This usually means an environment variable isn’t set.
Examples
Type a password
Read secrets from environment variables, not from your test code. See Secrets.Replace the text in a field
type() adds to what’s already in the field. Select the old text first to replace it:
Type several lines
type() doesn’t press Enter for you. Use pressKeys() between lines:
Complete example
tests/login.test.mjs
Related
- pressKeys(): press Enter, Tab and shortcuts
- click(): focus a field before you type
- Secrets: keep credentials out of your test code
- Perform actions: every kind of action in one guide

