File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 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
99 # Cross platform way of entering text into a textfield
1010 def type text
1111 # 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
1219 js = <<-JS
1320 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+ }
1527 JS
1628 @driver . execute_script js
1729 end
You can’t perform that action at this time.
0 commit comments