code: private String getMimeType(String resource) {
      if (resource.endsWith(".png")) {
        return "image/png";
      } else if (resource.endsWith(".css")) {
        return "text/css";
      } else if (resource.endsWith(".js")) {
        return "application/x-javascript";
      } else if (resource.endsWith(".jpg")) {
        return "image/jpeg";
      } else if (resource.endsWith(".gif")) {
        return "image/gif";
      }
      throw new WebDriverException("mime type NI" + resource);
    }
docs: TODO freynaud