@Override public ElementsCollection execute(SelenideElement proxy, final WebElementSource selectElement, Object[] args) { return new ElementsCollection(new WebElementsCollection() { @Override public List<WebElement> getElements() { return new Select(selectElement.getWebElement()).getAllSelectedOptions(); } @Override public String description() { return selectElement.getSearchCriteria() + " selected options"; } @Override public Driver driver() { return selectElement.driver(); } }); } }
/** * Takes the snapshot of current state of this collection. * Succeeding calls to this object WILL NOT RELOAD collection element from browser. * * Use it to speed up your tests - but only if you know that collection will not be changed during the test. * * @return current state of this collection */ public ElementsCollection snapshot() { return new ElementsCollection(fetch()); }
public ElementsCollection $$(Collection<? extends WebElement> elements) { return new ElementsCollection(driver(), elements); }
public ElementsCollection $$(String cssSelector) { return new ElementsCollection(driver(), cssSelector); }
public ElementsCollection findAll(By seleniumSelector) { return new ElementsCollection(driver(), seleniumSelector); }
/** * Filters collection elements based on the given condition (lazy evaluation) * ATTENTION! Doesn't start any search yet. Search will be started when action or assert is applied * @param condition * @return ElementsCollection */ public ElementsCollection filter(Condition condition) { return new ElementsCollection(new FilteringCollection(collection, condition)); }
/** * returns the first n elements of the collection (lazy evaluation) * ATTENTION! Doesn't start any search yet. Search will be started when action or assert is applied (.click(), should..() etc.) * @param elements number of elements 1..N */ public ElementsCollection first(int elements) { return new ElementsCollection(new HeadOfCollection(collection, elements)); }
/** * returns the last n elements of the collection (lazy evaluation) * ATTENTION! Doesn't start any search yet. Search will be started when action or assert is applied (.click(), should..() etc.) * @param elements number of elements 1..N */ public ElementsCollection last(int elements) { return new ElementsCollection(new TailOfCollection(collection, elements)); }
/** * Filters elements excluding those which met the given condition (lazy evaluation) * ATTENTION! Doesn't start any search yet. Search will be started when action or assert is applied * @param condition * @return ElementsCollection */ public ElementsCollection exclude(Condition condition) { return new ElementsCollection(new FilteringCollection(collection, not(condition))); }
@Override public ElementsCollection execute(SelenideElement parent, WebElementSource locator, Object[] args) { return new ElementsCollection(new BySelectorCollection(locator.driver(), parent, WebElementSource.getSelector(args[0]))); } }
@Override public ElementsCollection execute(SelenideElement parent, WebElementSource locator, Object... args) { return new ElementsCollection(new BySelectorCollection(locator.driver(), parent, By.xpath((String) args[0]))); }
@Override public Object decorate(ClassLoader loader, Field field) { By selector = new Annotations(field).buildBy(); if (WebElement.class.isAssignableFrom(field.getType())) { return ElementFinder.wrap(driver, searchContext, selector, 0); } if (ElementsCollection.class.isAssignableFrom(field.getType())) { return new ElementsCollection(new BySelectorCollection(driver, searchContext, selector)); } else if (ElementsContainer.class.isAssignableFrom(field.getType())) { return createElementsContainer(selector, field); } else if (isDecoratableList(field, ElementsContainer.class)) { return createElementsContainerList(field); } else if (isDecoratableList(field, SelenideElement.class)) { return SelenideElementListProxy.wrap(driver, factory.createLocator(field)); } return super.decorate(loader, field); }
public ElementsCollection findAll(By by) { return new ElementsCollection(new BySelectorCollection(WebDriverRunner.driver(), by)); }
public ElementsCollection findAll(By by) { return new ElementsCollection(new BySelectorCollection(WebDriverRunner.driver(), by)); }
public ElementsCollection findAll(By by) { return new ElementsCollection(new BySelectorCollection(WebDriverRunner.driver(), by)); }
public ElementsCollection findAll(By by) { return new ElementsCollection(new BySelectorCollection(WebDriverRunner.driver(), by)); }
public ElementsCollection findAll(String cssSelector) { return new ElementsCollection(new BySelectorCollection(WebDriverRunner.driver(), By.cssSelector(cssSelector))); }
public ElementsCollection findAll(String cssSelector) { return new ElementsCollection(new BySelectorCollection(WebDriverRunner.driver(), By.cssSelector(cssSelector))); }
public ElementsCollection findAll(String cssSelector) { return new ElementsCollection(new BySelectorCollection(WebDriverRunner.driver(), By.cssSelector(cssSelector))); }
public ElementsCollection findAll(String cssSelector) { return new ElementsCollection(new BySelectorCollection(WebDriverRunner.driver(), By.cssSelector(cssSelector))); }