@JsonRpcErrors({@JsonRpcError(exception = CustomTestException.class, code = 1234)}) Object testMethod(); }
@JsonRpcErrors({@JsonRpcError(exception = CustomTestException.class, code = -5678, message = "The message", data = "The data")}) Object testMethod(); }
/** * Simulates a short press using key name. * @param key possible key name is home, back, left, right, up, down, center, menu, search, enter, delete(or del), recent(recent apps), volume_up, volume_down, volume_mute, camera, power * @return true if successful, else return false * @throws RemoteException */ @JsonRpcErrors({@JsonRpcError(exception=RemoteException.class, code=ERROR_CODE_BASE-1)}) boolean pressKey(String key) throws RemoteException;
/** * Long clicks bottom and right corner of the UI element * @param obj the target ui object. * @param corner "br"/"bottomright" means BottomRight, "tl"/"topleft" means TopLeft, "center" means Center. * @return true if operation was successful * @throws UiObjectNotFoundException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) boolean longClick(Selector obj, String corner) throws UiObjectNotFoundException;
/** * Scrolls to the beginning of a scrollable layout element. The beginning can be at the top-most edge in the case of vertical controls, or the left-most edge for horizontal controls. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew. * @param obj the selector of the scrollable object * @param isVertical vertical or horizontal * @param maxSwipes max swipes to be performed. * @param steps use steps to control the speed, so that it may be a scroll, or fling * @return true on scrolled else false * @throws UiObjectNotFoundException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) boolean scrollToBeginning(Selector obj, boolean isVertical, int maxSwipes, int steps) throws UiObjectNotFoundException;
/** * Scrolls to the end of a scrollable layout element. The end can be at the bottom-most edge in the case of vertical controls, or the right-most edge for horizontal controls. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew. * @param obj the selector of the scrollable object * @param isVertical vertical or horizontal * @param maxSwipes max swipes to be performed. * @param steps use steps to control the speed, so that it may be a scroll, or fling * @return true on scrolled, else false * @throws UiObjectNotFoundException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) boolean scrollToEnd(Selector obj, boolean isVertical, int maxSwipes, int steps) throws UiObjectNotFoundException;
/** * Reads the text property of the UI element * @param obj the id of the UiObject. * @return text value of the current node represented by this UiObject * @throws UiObjectNotFoundException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) String getText(String obj) throws UiObjectNotFoundException;
/** * Performs a click at the center of the visible bounds of the UI element represented by this UiObject. * @param obj the id of target ui object. * @return true id successful else false * @throws UiObjectNotFoundException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) boolean click(String obj) throws UiObjectNotFoundException;
/** * Long clicks the center of the visible bounds of the UI element * @param obj the id of target ui object. * @return true if operation was successful * @throws UiObjectNotFoundException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) boolean longClick(String obj) throws UiObjectNotFoundException;
/** * Performs a swipe from one coordinate to another coordinate. You can control the smoothness and speed of the swipe by specifying the number of steps. Each step execution is throttled to 5 milliseconds per step, so for a 100 steps, the swipe will take around 0.5 seconds to complete. * @param startX X-axis value for the starting coordinate * @param startY Y-axis value for the starting coordinate * @param endX X-axis value for the ending coordinate * @param endY Y-axis value for the ending coordinate * @param steps is the number of steps for the swipe action * @return true if swipe is performed, false if the operation fails or the coordinates are invalid * @throws NotImplementedException */ @JsonRpcErrors({@JsonRpcError(exception=NotImplementedException.class, code=ERROR_CODE_BASE-3)}) boolean drag(int startX, int startY, int endX, int endY, int steps) throws NotImplementedException;
/** * Performs a forward scroll with the default number of scroll steps (55). If the swipe direction is set to vertical, then the swipes will be performed from bottom to top. If the swipe direction is set to horizontal, then the swipes will be performed from right to left. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew. * @param obj the selector of the scrollable object * @param isVertical vertical or horizontal * @param steps number of steps. Use this to control the speed of the scroll action. * @return true on scrolled, else false * @throws UiObjectNotFoundException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) boolean scrollForward(Selector obj, boolean isVertical, int steps) throws UiObjectNotFoundException;
/** * Perform a scroll forward action to move through the scrollable layout element until a visible item that matches the selector is found. * @param obj the selector of the scrollable object * @param targetObj the item matches the selector to be found. * @param isVertical vertical or horizontal * @return true on scrolled, else false * @throws UiObjectNotFoundException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) boolean scrollTo(Selector obj, Selector targetObj, boolean isVertical) throws UiObjectNotFoundException;
/** * Searches for child UI element within the constraints of this UiSelector. It looks for any child matching the childPattern argument that has a child UI element anywhere within its sub hierarchy that is at the instance specified. The operation is performed only on the visible items and no scrolling is performed in this case. * @param collection Selector of UiCollection or UiScrollable * @param child UiSelector selector of the child pattern to match and return * @param instance int the desired matched instance of this childPattern * @return A string ID represent the returned UiObject. */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) String childByInstance(Selector collection, Selector child, int instance) throws UiObjectNotFoundException;
/** * Sets the text in an editable field, after clearing the field's content. The UiSelector selector of this object must reference a UI element that is editable. When you call this method, the method first simulates a click() on editable field to set focus. The method then clears the field's contents and injects your specified text into the field. If you want to capture the original contents of the field, call getText() first. You can then modify the text and use this method to update the field. * @param obj the id of the UiObject. * @param text string to set * @return true if operation is successful * @throws UiObjectNotFoundException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) boolean setText(String obj, String text) throws UiObjectNotFoundException;
/** * Waits a specified length of time for a view to become undetectable. This method waits until a view is no longer matchable, or until the timeout has elapsed. A view becomes undetectable when the UiSelector of the object is unable to find a match because the element has either changed its state or is no longer displayed. You can use this method when attempting to wait for some long operation to compete, such as downloading a large file or connecting to a remote server. * @param obj the id of target ui object * @param timeout time to wait (in milliseconds) * @return true if the element is gone before timeout elapsed, else false if timeout elapsed but a matching element is still found. */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2)}) boolean waitUntilGone(String obj, long timeout) throws UiObjectNotFoundException;
/** * Drags this object to a destination UiObject. The number of steps specified in your input parameter can influence the drag speed, and varying speeds may impact the results. Consider evaluating different speeds when using this method in your tests. * @param obj the ui object to be dragged. * @param destObj the ui object to be dragged to. * @param steps usually 40 steps. You can increase or decrease the steps to change the speed. * @return true if successful * @throws UiObjectNotFoundException * @throws NotImplementedException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2), @JsonRpcError(exception=NotImplementedException.class, code=ERROR_CODE_BASE-3)}) boolean dragTo(Selector obj, Selector destObj, int steps) throws UiObjectNotFoundException, NotImplementedException;
/** * Performs a two-pointer gesture, where each pointer moves diagonally toward the other, from the edges to the center of this UiObject . * @param obj the target ui object. * @param percent percentage of the object's diagonal length for the pinch gesture * @param steps the number of steps for the gesture. Steps are injected about 5 milliseconds apart, so 100 steps may take around 0.5 seconds to complete. * @return true if all touch events for this gesture are injected successfully, false otherwise * @throws UiObjectNotFoundException * @throws NotImplementedException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2), @JsonRpcError(exception=NotImplementedException.class, code=ERROR_CODE_BASE-3)}) boolean pinchIn(Selector obj, int percent, int steps) throws UiObjectNotFoundException, NotImplementedException;
/** * Drags this object to arbitrary coordinates. The number of steps specified in your input parameter can influence the drag speed, and varying speeds may impact the results. Consider evaluating different speeds when using this method in your tests. * @param obj the id of ui object to be dragged. * @param destX the X-axis coordinate of destination. * @param destY the Y-axis coordinate of destination. * @param steps usually 40 steps. You can increase or decrease the steps to change the speed. * @return true if successful * @throws UiObjectNotFoundException * @throws NotImplementedException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2), @JsonRpcError(exception=NotImplementedException.class, code=ERROR_CODE_BASE-3)}) boolean dragTo(String obj, int destX, int destY, int steps) throws UiObjectNotFoundException, NotImplementedException;
/** * Performs a two-pointer gesture, where each pointer moves diagonally toward the other, from the edges to the center of this UiObject . * @param obj the id of target ui object. * @param percent percentage of the object's diagonal length for the pinch gesture * @param steps the number of steps for the gesture. Steps are injected about 5 milliseconds apart, so 100 steps may take around 0.5 seconds to complete. * @return true if all touch events for this gesture are injected successfully, false otherwise * @throws UiObjectNotFoundException * @throws NotImplementedException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2), @JsonRpcError(exception=NotImplementedException.class, code=ERROR_CODE_BASE-3)}) boolean pinchIn(String obj, int percent, int steps) throws UiObjectNotFoundException, NotImplementedException;
/** * Performs a two-pointer gesture, where each pointer moves diagonally opposite across the other, from the center out towards the edges of the this UiObject. * @param obj the id of target ui object. * @param percent percentage of the object's diagonal length for the pinch gesture * @param steps the number of steps for the gesture. Steps are injected about 5 milliseconds apart, so 100 steps may take around 0.5 seconds to complete. * @return true if all touch events for this gesture are injected successfully, false otherwise * @throws UiObjectNotFoundException * @throws NotImplementedException */ @JsonRpcErrors({@JsonRpcError(exception=UiObjectNotFoundException.class, code=ERROR_CODE_BASE-2), @JsonRpcError(exception=NotImplementedException.class, code=ERROR_CODE_BASE-3)}) boolean pinchOut(String obj, int percent, int steps) throws UiObjectNotFoundException, NotImplementedException;