/** * Perform a trashcan search on itemName. Return the list of all trashcan items with matching * name. * * @param drone * @param itemName String to search for * @return List<String> */ public static List<String> getTrashCanItems(WebDrone drone, String itemName) { List<String> namesOfFiles = new ArrayList<String>(); TrashCanPage trashcanPage = (TrashCanPage) getSharePage(drone); trashcanPage.render(); trashcanPage = trashcanPage.itemSearch(itemName).render(); for (TrashCanItem item : trashcanPage.getTrashCanItems()) { namesOfFiles.add(item.getFileName()); } return namesOfFiles; }
/** * Retrieve TrashCanItem based on its name input. Assumes User is on TrashCanPage * * @param drone * @param contentName * @return */ public static TrashCanItem getTrashCanItem(WebDrone drone, String contentName) { List<TrashCanItem> trashCanItems = new ArrayList<TrashCanItem>(); TrashCanPage trashCan = (TrashCanPage) getSharePage(drone).render(); trashCanItems.addAll(trashCan.getTrashCanItems()); TrashCanItem item = getItemPresentInThePage(contentName, trashCanItems); if (item != null) { return item; } while (trashCan.hasNextPage()) { trashCan = trashCan.selectNextPage().render(); // trashCanItems.addAll(trashCan.getTrashCanItems()); item = getItemPresentInThePage(contentName, trashCan.getTrashCanItems()); if (item != null) { return item; } } throw new ShareException("Incorrect content :" + contentName); }