public static boolean hasCssClass(WebElement element, String... cssClass) {
        String elementClass = element.getDomAttribute("class");
        if (elementClass == null) {
            return false;
        }

        String[] elementClasses = elementClass.split(" ");

        boolean result = true;
        for (String expected : cssClass) {
            boolean found = false;
            for (String actual : elementClasses) {
                if (actual.equalsIgnoreCase(expected)) {
                    found = true;
                    break;
                }
            }

            if (!found) {
                result = false;
                break;
            }
        }

        return result;
    }
Checks a WebElement if it has a CSS class or classes. If more than one is listed then ALL must be found on the element.

@param element the element to check
@param cssClass the CSS class or classes to look for
@return true if this element has the CSS class
primefaces-selenium/primefaces-selenium-core/src/main/java/org/primefaces/selenium/PrimeSelenium.java