File tree 2 files changed +6
-19
lines changed
2 files changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -379,12 +379,18 @@ def eles_by_json_visible_exact element, value
379
379
# @return [void]
380
380
def hide_ios_keyboard close_key = 'Done'
381
381
=begin
382
+ todo: there are many various ways to hide the keyboard that work in different
383
+ app specific circumstances. webview keyboard will require a window.tap for example.
384
+
382
385
Find the top left corner of the keyboard and move up 10 pixels (origin.y - 10)
383
386
now swipe down until the end of the window - 10 pixels.
384
387
-10 to ensure we're not going outside the window bounds.
385
388
386
389
Swiping inside the keyboard will not dismiss it.
387
390
391
+ If the 'Done' key exists then that should be pressed to dismiss the keyboard
392
+ because swiping to dismiss works only if such key doesn't exist.
393
+
388
394
Don't use window.tap. See https://github.com/appium/appium-uiauto/issues/28
389
395
=end
390
396
dismiss_keyboard = ( <<-JS ) . strip
Original file line number Diff line number Diff line change @@ -14,27 +14,8 @@ def label
14
14
15
15
# Cross platform way of entering text into a textfield
16
16
def type text
17
- # enter text then tap window to hide the keyboard.
18
- =begin
19
- Find the top left corner of the keyboard and move up 10 pixels (origin.y - 10)
20
- now swipe down until the end of the window - 10 pixels.
21
- -10 to ensure we're not going outside the window bounds.
22
-
23
- Swiping inside the keyboard will not dismiss it.
24
-
25
- var startY = au.mainApp().keyboard().rect().origin.y - 10;
26
- var endY = au.mainWindow().rect().size.height - 10;
27
- au.flickApp(0, startY, 0, endY);
28
-
29
- The above logic has been accepted as part of appium's au.hideKeyboard
30
- https://github.com/appium/appium-uiauto/blob/dbeb4eedbdea2104751a0d547ac9b2894e0dc567/uiauto/appium/app.js#L902
31
-
32
- If the 'Done' key exists then that should be pressed to dismiss the keyboard
33
- because swiping to dismiss works only if such key doesn't exist.
34
- =end
35
17
# type
36
18
$driver. execute_script %(au.getElement('#{ self . ref } ').setValue('#{ text } ');)
37
- $driver. hide_ios_keyboard
38
19
end # def type
39
20
end # Selenium::WebDriver::Element.class_eval
40
21
end # def patch_webdriver_element
You can’t perform that action at this time.
0 commit comments