|
| 1 | +package io.appium.java_client; |
| 2 | + |
| 3 | +import org.openqa.selenium.WebElement; |
| 4 | + |
| 5 | +public interface TouchShortcuts { |
| 6 | + |
| 7 | +/** |
| 8 | + * Convenience method for "zooming in" on an element on the screen. |
| 9 | + * "zooming in" refers to the action of two appendages pressing the screen and sliding away from each other. |
| 10 | + * NOTE: |
| 11 | + * This convenience method slides touches away from the element, if this would happen to place one of them |
| 12 | + * off the screen, appium will return an outOfBounds error. In this case, revert to using the MultiTouchAction api |
| 13 | + * instead of this method. |
| 14 | + * |
| 15 | + * @param x x coordinate to start zoom on |
| 16 | + * @param y y coordinate to start zoom on |
| 17 | + */ |
| 18 | + public void zoom(int x, int y); |
| 19 | + |
| 20 | +/** |
| 21 | + * Convenience method for "zooming in" on an element on the screen. |
| 22 | + * "zooming in" refers to the action of two appendages pressing the screen and sliding away from each other. |
| 23 | + * NOTE: |
| 24 | + * This convenience method slides touches away from the element, if this would happen to place one of them |
| 25 | + * off the screen, appium will return an outOfBounds error. In this case, revert to using the MultiTouchAction api |
| 26 | + * instead of this method. |
| 27 | + * |
| 28 | + * @param el The element to pinch |
| 29 | + */ |
| 30 | + public void zoom(WebElement el); |
| 31 | + |
| 32 | +/** |
| 33 | + * Convenience method for tapping a position on the screen |
| 34 | + * |
| 35 | + * @param fingers |
| 36 | + * number of fingers/appendages to tap with |
| 37 | + * @param x |
| 38 | + * x coordinate |
| 39 | + * @param y |
| 40 | + * y coordinate |
| 41 | + * @param duration |
| 42 | + */ |
| 43 | +public void tap(int fingers, int x, int y, int duration); |
| 44 | + |
| 45 | +/** |
| 46 | + * Convenience method for tapping the center of an element on the screen |
| 47 | + * |
| 48 | + * @param fingers |
| 49 | + * number of fingers/appendages to tap with |
| 50 | + * @param element |
| 51 | + * element to tap |
| 52 | + * @param duration |
| 53 | + * how long between pressing down, and lifting fingers/appendages |
| 54 | + */ |
| 55 | +public void tap(int fingers, WebElement element, int duration); |
| 56 | + |
| 57 | +/** |
| 58 | + * Convenience method for swiping across the screen |
| 59 | + * |
| 60 | + * @param startx |
| 61 | + * starting x coordinate |
| 62 | + * @param starty |
| 63 | + * starting y coordinate |
| 64 | + * @param endx |
| 65 | + * ending x coordinate |
| 66 | + * @param endy |
| 67 | + * ending y coordinate |
| 68 | + * @param duration |
| 69 | + * amount of time in milliseconds for the entire swipe action to |
| 70 | + * take |
| 71 | + */ |
| 72 | +public void swipe(int startx, int starty, int endx, int endy, int duration); |
| 73 | + |
| 74 | +/** |
| 75 | + * Convenience method for pinching an element on the screen. |
| 76 | + * "pinching" refers to the action of two appendages pressing the screen and sliding towards each other. |
| 77 | + * NOTE: |
| 78 | + * This convenience method places the initial touches around the element at a distance, if this would happen to place |
| 79 | + * one of them off the screen, appium will return an outOfBounds error. In this case, revert to using the |
| 80 | + * MultiTouchAction api instead of this method. |
| 81 | + * |
| 82 | + * @param x x coordinate to terminate the pinch on |
| 83 | + * @param y y coordinate to terminate the pinch on |
| 84 | + */ |
| 85 | + public void pinch(int x, int y); |
| 86 | + |
| 87 | +/** |
| 88 | + * Convenience method for pinching an element on the screen. |
| 89 | + * "pinching" refers to the action of two appendages pressing the screen and sliding towards each other. |
| 90 | + * NOTE: |
| 91 | + * This convenience method places the initial touches around the element, if this would happen to place one of them |
| 92 | + * off the screen, appium with return an outOfBounds error. In this case, revert to using the MultiTouchAction api |
| 93 | + * instead of this method. |
| 94 | + * |
| 95 | + * @param el The element to pinch |
| 96 | + */ |
| 97 | + public void pinch(WebElement el); |
| 98 | + |
| 99 | +} |
0 commit comments