code: public static Condition attribute(final String attributeName) {
      return new Condition("attribute") {
        @Override
        public boolean apply(Driver driver, WebElement element) {
          return element.getAttribute(attributeName) != null;
        }
  
        @Override
        public String toString() {
          return name + " " + attributeName;
        }
      };
    }
docs: Check if element has given attribute (with any value)
  
  <p>Sample: <code>$("#mydiv").shouldHave(attribute("fileId"));</code></p>
  
  @param attributeName name of attribute, not null
  @return true iff attribute exists