6 Replies
      Latest reply on Jan 17, 2019 2:18 AM by Sneha.Kolukuluri
      Miller Level 1 Level 1 (0 points)

        I'm trying to type a character of a string into a text field with Swift:

         

                let textField2 = element.childrenMatchingType(.TextField).elementBoundByIndex(1)
                textField2.tap()
                textField2.typeText(String(passkey[passkey.startIndex]))
        

         

        However, I'm getting the dreaded "UI Testing Failure - Neither element nor any descendant has keyboard focus. Element:" error message.

         

        Since I'm for sure tapping this field, and since the iPad's keyboard appears when this tap takes place, I'm led to believe that this is a bug in XCTest. To work around this for now, I'd like to just force keyboard entry, even if XCTest doesn't think there's a field to accept such text.


        Is there a way to force keyboard entry?