private Point getCenterCoordinates() {
    if (!isDisplayed()) {
      final String msg = "This WebElement is not visible and may not be clicked.";
      if (android.os.Build.VERSION.SDK_INT <= 18) {
        throw new ElementNotVisibleException(msg);
      } else {
        // just give it a try
        Log.w("SelendroidWebDriver", msg);
      }
    }
    driver.setEditAreaHasFocus(false);
    Point topLeft = getLocation();
    String sizeJs =
        "var __webdriver_w = 0;" + "var __webdriver_h = 0;"
            + "if (arguments[0].getClientRects && arguments[0].getClientRects()[0]) {"
            + "  __webdriver_w = arguments[0].getClientRects()[0].width;"
            + "  __webdriver_h = arguments[0].getClientRects()[0].height;" + " } else {"
            + "  __webdriver_w = arguments[0].offsetWidth;"
            + "  __webdriver_h = arguments[0].offsetHeight;"
            + "}; return __webdriver_w + ',' + __webdriver_h;";
    String[] result = null;
    try {
      JSONObject response = new JSONObject((String) driver.executeScript(sizeJs, this, null));
      result = response.getString("value").split(",");
    } catch (JSONException e) {
      throw new SelendroidException(e);
    }

    int xSize = (new Double(result[0])).intValue();
    int ySize = (new Double(result[1])).intValue();
    return new Point(topLeft.x + xSize / 2, topLeft.y+ ySize / 2);
  }
@return a {@link Point} where x is the width, and y is the height.
selendroid-server/src/main/java/io/selendroid/server/model/AndroidWebElement.java