Xcode UI Test UIKeyInput typeText

房东的猫 提交于 2019-12-05 08:44:30

I've found solution for UIKeyInput. Please, use:

app.keys["1"].tap()
app.keys["2"].tap()
app.keys["3"].tap()
app.keys["4"].tap()

// Instead of app.typeText("1234")

The CodeInputView needs focus before typing text will work. Access the input by either its placeholder text or set the accessibility label manually.

let app = XCUIApplication()
let codeTextField = app.textFields["Your code"]

codeTextField.tap()
app.typeText("1234")

The above assumes the placeholder or accessibility label was set to "Your code".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!