/** * Find the first element which met the given condition (lazy evaluation) * ATTENTION! Doesn't start any search yet. Search will be started when action or assert is applied * @see #find(Condition) * @param condition * @return SelenideElement */ public SelenideElement findBy(Condition condition) { return find(condition); }
private void moveThroughPages(int offsetFromActual) { SelenideElement ul = getParentElement().$(By.cssSelector(".pagination.pagination-sm.no-margin.pull-right")); ElementsCollection col = ul.$$x(".//li"); SelenideElement active = col.find(Condition.cssClass("active")); int index = col.indexOf(active); index = index + offsetFromActual; if (index < 2 || index > col.size() - 2) { // it's <<, <, >, >> throw new SchrodingerException("Can't move through paging, page doesn't exist"); } col.get(index).$x(".//a").click(); }