public void sort(String headerText) {
        Optional<HeaderCell> cell = getHeader().getCell(headerText);
        if (cell.isPresent()) {
            PrimeSelenium.guardAjax(cell.get().getWebElement().findElement(By.className("ui-sortable-column-icon"))).click();
        }
        else {
            System.err.println("Header Cell '" + headerText + "' not found.");
        }
    }
Sorts the column found by its header text. It toggles to the next sort direction.

@param headerText the header text to look for
primefaces-selenium/primefaces-selenium-components/src/main/java/org/primefaces/selenium/component/base/AbstractTable.java