code: @SuppressWarnings("unchecked")
      public Map<String, String> allAttributes() {
          if (!element.is().present()) {
              return null;
          }
          try {
              WebElement webElement = element.getWebElement();
              JavascriptExecutor js = (JavascriptExecutor) driver;
              return (Map<String, String>) js.executeScript(
                      "var items = {}; for (index = 0; index < arguments[0].attributes.length; ++index) { items[arguments[0].attributes[index].name] = arguments[0].attributes[index].value }; return items;",
                      webElement);
          } catch (NoSuchMethodError | Exception e) {
              log.warn(e);
              return null;
          }
      }
docs: Retrieves all attributes of the element. If the element isn't present, or
  the attributes can't be accessed, a null value will be returned.
  
  @return String: the value of the css attribute