public void sort(int index) {
        HeaderCell cell = getHeader().getCell(index);
        if (cell != null) {
            PrimeSelenium.guardAjax(cell.getWebElement().findElement(By.className("ui-sortable-column-icon"))).click();
        }
        else {
            System.err.println("Header Cell '" + index + "' not found.");
        }
    }
Sorts the column found by its index. It toggles to the next sort direction.

@param index the index of the column
primefaces-selenium/primefaces-selenium-components/src/main/java/org/primefaces/selenium/component/base/AbstractTable.java