The problem is not that .typeText(_:) not working, it means that your request does not allow the element.
Sometimes it may seem that the request is not working properly when the view you are trying to find is inside an accessible container view. You can reduce this by explicitly disabling accessibility in the container view.
Set the stack view that contains the text view so that it is not an accessibility element, and then set the accessibility identifier in the text view.
// app code let stack: UIStackView! let textView: UITextView! stack.isAccessibilityElement = false textView.isAccessibilityElement = true textView.accessibilityIdentifier = "myTextView" // test code let app = XCUIApplication() let textView = app.textViews["myTextView"] textView.typeText("something")
source share