Wait for elements to be valid before attempting to type in them

Wait for elements to be valid before attempting to type in them. I was finding that sometimes the "type" would be failing because an alert window was still the keyWindow when [self hasKeyboardFocus] would attempt to generate an accessibilityPath.
I think it would be simpler just to amend this line to read `if (![self isValid] || ![self hasKeyboardFocus]) {…`. Then we can use `tap` to wait for validity.