【发布时间】:2015-08-25 14:23:49
【问题描述】:
XCTAssertTrue(app.keyboards.elementBoundByIndex(0).exists) 导致崩溃。那该怎么做呢?是否可以检查keaboard是否存在?
【问题讨论】:
标签: ios swift xcode ios9 xcode-ui-testing
XCTAssertTrue(app.keyboards.elementBoundByIndex(0).exists) 导致崩溃。那该怎么做呢?是否可以检查keaboard是否存在?
【问题讨论】:
标签: ios swift xcode ios9 xcode-ui-testing
XCTAssertEqual(app.keyboards.count, 1) - 键盘存在。
XCTAssertEqual(app.keyboards.count, 0) - 键盘不存在。
【讨论】:
另一种方法是检查textField是否包含Keyboard Focused
let emailTextField = app.textFields.element(boundBy: 0)
XCTAssertTrue(emailTextField.debugDescription.contains("Keyboard Focused")))
【讨论】: