Esempio n. 1
0
 /**
  * clicks in the input control on the input index
  *
  * @param commandParameters [0] the control id , [1] the index of the item to click
  * @return response with the status of the command
  * @throws Exception
  */
 private CommandResponse clickInControlByIndex(String[] commandParameters) throws Exception {
   String command = "The command clickInControlByIndex";
   CommandResponse result = new CommandResponse();
   try {
     int controlId = Integer.parseInt(commandParameters[0]);
     int indexToClickOn = Integer.parseInt(commandParameters[1]);
     command += "(controlId: " + controlId + ")";
     command += "(indexToClickOn: " + indexToClickOn + ")";
     View control = this.solo.getView(controlId);
     if (control != null) {
       if (indexToClickOn < control.getTouchables().size()) {
         clickOnView(control.getTouchables().get(indexToClickOn), false, false);
         result.setResponse(command);
         result.setSucceeded(true);
       } else {
         result.setResponse(
             command
                 + "failed due to: index to click in control is out of bounds. control touchables: "
                 + control.getTouchables().size());
         result.setSucceeded(false);
       }
     } else {
       result.setResponse(command + "failed due to failed to find control with id: " + controlId);
       result.setSucceeded(false);
     }
   } catch (Throwable e) {
     result = handleException(command, e);
   }
   return result;
 }
Esempio n. 2
0
  private View getTouchTarget(View view, int x, int y) {
    View target = null;
    ArrayList<View> TouchableViews = view.getTouchables();
    for (View child : TouchableViews) {
      if (isTouchPointInView(child, x, y) && child != RippleLayout.this) {
        target = child;
        break;
      }
    }

    return target;
  }