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.