File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,21 @@ def patch_webdriver_element
9
9
# Cross platform way of entering text into a textfield
10
10
def type text
11
11
# enter text then tap window to hide the keyboard.
12
+ =begin
13
+ Find the top left corner of the keyboard and move up 10 pixels (origin.y - 10)
14
+ now swipe down until the end of the window - 10 pixels.
15
+ -10 to ensure we're not going outside the window bounds.
16
+
17
+ Swiping inside the keyboard will not dismiss it.
18
+ =end
12
19
js = <<-JS
13
20
au.getElement('#{ self . ref } ').setValue('#{ text } ');
14
- au.lookup('window')[0].tap();
21
+
22
+ if (au.mainApp.keyboard().type() !== "UIAElementNil") {
23
+ var startY = au.mainApp.keyboard().rect().origin.y - 10;
24
+ var endY = au.mainWindow.rect().size.height - 10;
25
+ au.flickApp(0, startY, 0, endY);
26
+ }
15
27
JS
16
28
@driver . execute_script js
17
29
end
You can’t perform that action at this time.
0 commit comments