public Paging<T> pageSize(int size) { Validate.isTrue(size > 0, "Size must be larger than zero."); SelenideElement parent = getParentElement(); SelenideElement button = parent.$(By.cssSelector(".btn.btn-default.dropdown-toggle")); button.click(); button.parent().$(By.className("dropdown-menu")).$$x(".//a").first().click(); SelenideElement popover = parent.$$(By.className("popover-title")) .findBy(Condition.text("Page size")).parent(); //todo fix localization popover.$(By.tagName("input")).setValue(Integer.toString(size)); popover.$(By.tagName("button")).click(); return this; }
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(); }