Try this check:
let app = XCUIApplication() XCTAssert(app.keyboards.count > 0, "The keyboard is not shown")
Or check for specific keyboard keys, for example:
let app = XCUIApplication() XCTAssert(app.keyboards.buttons["Next:"].exists, "The keyboard has no Next button")
You can also control keyboard interaction:
let app = XCUIApplication() app.keyboards.buttons["Next:"].tap()
source share