private boolean hasNext() { WebElement element = cataloguePage.getMainBlock().getNextPage(); if (!CollectionUtils.isEmpty(element.findElements(By.className(NavigationLine.ACTIVE_LINK)))) { return true; } return false; }
private void next() { WebElement element = cataloguePage.getMainBlock().getNextPage(); if (!CollectionUtils.isEmpty(element.findElements(By.className(NavigationLine.ACTIVE_LINK)))) { element.findElement(By.className(NavigationLine.ACTIVE_LINK)).click(); } }
public List<Item> grabItems() { List<Item> result = new ArrayList<Item>(); List<WebElement> items = cataloguePage.getMainBlock().getDivClassItem(); for (WebElement item : items) { BreadMaker breadMaker = new BreadMaker(); String name = cataloguePage.getMainBlock().getDivClassName().getText(); int price = extratNumbers(cataloguePage.getMainBlock().getPriceStrong().getText()); String description = item.findElement(By.xpath(cataloguePage.getMainBlock().CLASS_DESCRIPTION)).getText(); breadMaker.setName(name); breadMaker.setPrice(price); breadMaker.setDescription(description); result.add(breadMaker); } return result; }