@@ -527,62 +527,6 @@ def eles_by_json_visible_exact(element, value)
527527 eles_by_json string_visible_exact element , value
528528 end
529529
530- # @private
531- # For Appium(automation name), not XCUITest
532- # If there's no keyboard, then do nothing.
533- # If there's no close key, fallback to window tap.
534- # If close key is present then tap it.
535- # @param close_key [String] close key to tap. Default value is 'Done'
536- # @return [void]
537- def hide_ios_keyboard ( close_key = 'Done' )
538- #
539- # TODO: there are many various ways to hide the keyboard that work in different
540- # app specific circumstances. webview keyboard will require a window.tap for example.
541- #
542- # Find the top left corner of the keyboard and move up 10 pixels (origin.y - 10)
543- # now swipe down until the end of the window - 10 pixels.
544- # -10 to ensure we're not going outside the window bounds.
545- #
546- # Swiping inside the keyboard will not dismiss it.
547- #
548- # If the 'Done' key exists then that should be pressed to dismiss the keyboard
549- # because swiping to dismiss works only if such key doesn't exist.
550- #
551- # Don't use window.tap. See https://github.com/appium/appium-uiauto/issues/28
552- #
553- dismiss_keyboard = <<-JS . strip
554- if (!au.mainApp().keyboard().isNil()) {
555- var key = au.mainApp().keyboard().buttons()['#{ close_key } ']
556- if (key.isNil()) {
557- var startY = au.mainApp().keyboard().rect().origin.y - 10;
558- var endY = au.mainWindow().rect().size.height - 10;
559- au.flickApp(0, startY, 0, endY);
560- } else {
561- key.tap();
562- }
563- au.delay(1000);
564- }
565- JS
566-
567- ignore do
568- # wait 5 seconds for a wild keyboard to appear. if the textfield is disabled
569- # then setValue will work, however the keyboard will never display
570- # because users are normally not allowed to type into it.
571- wait_true ( 5 ) do
572- execute_script '!au.mainApp().keyboard().isNil()'
573- end
574-
575- # dismiss keyboard
576- execute_script dismiss_keyboard
577- end
578-
579- # wait 5 seconds for keyboard to go away.
580- # if the keyboard isn't dismissed then wait_true will error.
581- wait_true ( 5 ) do
582- execute_script 'au.mainApp().keyboard().isNil()'
583- end
584- end
585-
586530 #
587531 # predicate - the predicate to evaluate on the main app
588532 #
0 commit comments