---
title: "typeText(_:)"
framework: xcuiautomation
role: symbol
role_heading: Instance Method
path: "xcuiautomation/xcuielement/typetext(_:)"
---

# typeText(_:)

Types a string into the element.

## Declaration

```swift
func typeText(_ text: String)
```

## Discussion

Discussion The element or a descendant must have keyboard focus; otherwise the system raises an error. This API discards any modifiers set in the current context by perform(withKeyModifiers:block:) so that it strictly interprets the provided text. To input keys with modifier flags, use  typeKey(_:modifierFlags:).
