Example usage for org.openqa.selenium.support.pagefactory DefaultElementLocator DefaultElementLocator

List of usage examples for org.openqa.selenium.support.pagefactory DefaultElementLocator DefaultElementLocator

Introduction

In this page you can find the example usage for org.openqa.selenium.support.pagefactory DefaultElementLocator DefaultElementLocator.

Prototype

public DefaultElementLocator(SearchContext searchContext, AbstractAnnotations annotations) 

Source Link

Document

Use this constructor in order to process custom annotations.

Usage

From source file:com.cognifide.qa.bb.scope.nested.ScopedElementLocator.java

License:Apache License

/**
 * Constructs a scope out of the scope factory and the parent field, then searches for the injected field
 * in this scope./*from w w w. ja v a2s  . co  m*/
 */
@Override
public WebElement findElement() {
    WebElement context = scopeFactory.createLocator(scopeField).findElement();
    return new DefaultElementLocator(context, searchField).findElement();
}

From source file:com.cognifide.qa.bb.scope.nested.ScopedElementLocator.java

License:Apache License

/**
 * Constructs a scope out of the scope factory and the parent field, then searches for the injected field
 * in this scope.//w w w  .  ja  v a2 s  . c om
 */
@Override
public List<WebElement> findElements() {
    return scopeFactory.createLocator(scopeField).findElements().stream()
            .flatMap(element -> new DefaultElementLocator(element, searchField).findElements().stream())
            .collect(toList());
}

From source file:com.cognifide.qa.bb.scope.nested.ScopedElementLocatorFactory.java

License:Apache License

@Override
public ElementLocator createLocator(final Field field) {
    return field.isAnnotationPresent(Global.class) ? new DefaultElementLocator(webDriver, field)
            : new ScopedElementLocator(parentFactory, parentField, field);
}

From source file:com.cognifide.qa.bb.scope.nestedselector.NestedSelectorScopedLocatorFactory.java

License:Apache License

/**
 * Creates a locator for the given field.
 *//*from   w ww.  ja  v  a 2  s  .  c o  m*/
@Override
public ElementLocator createLocator(Field field) {
    return field.isAnnotationPresent(Global.class) ? new DefaultElementLocator(searchContext, field)
            : new SelectorScopedElementLocator(searchContext, selector, field);
}

From source file:com.cognifide.qa.bb.scope.selector.SelectorScopedElementLocator.java

License:Apache License

@Override
public WebElement findElement() {
    SearchContext context = getContext();
    return new DefaultElementLocator(context, field).findElement();
}

From source file:com.cognifide.qa.bb.scope.selector.SelectorScopedElementLocator.java

License:Apache License

@Override
public List<WebElement> findElements() {
    return selector.findElements(searchContext).stream()
            .flatMap(webElement -> new DefaultElementLocator(webElement, field).findElements().stream())
            .collect(toList());// ww  w .  j av a2  s .com
}

From source file:com.cognifide.qa.bb.scope.webelement.WebElementScopedLocatorFactory.java

License:Apache License

/**
 * Return a DefaultElementLocator./*w  w  w . j av  a 2 s. com*/
 */
@Override
public ElementLocator createLocator(Field field) {
    return new DefaultElementLocator(resolveContext(field), field);
}

From source file:com.github.licanhua.test.framework.base.CustomElementLocatorFactory.java

License:Apache License

private ElementLocator createLocator(SearchContext searchContext, Field field) {
    ElementContext context = parent.getElementContext();
    if (context.isAjax()) {
        logger.debug("AjaxElementLocator is created for " + field.getName()
                + " with AjaxTimeoutInSeconds setting: " + context.getAjaxTimeoutInSeconds());
        return new AjaxElementLocator(searchContext, field, context.getAjaxTimeoutInSeconds());
    } else {// w  ww . j  av  a  2 s.c  om
        logger.debug("DefaultElementLocator is created for " + field.getName());
        return new DefaultElementLocator(searchContext, field);
    }
}

From source file:org.nuxeo.functionaltests.VariableElementLocatorFactory.java

License:Open Source License

@Override
public ElementLocator createLocator(Field field) {
    if (field.getAnnotation(SlowLoading.class) != null) {
        return new AjaxElementLocator(driver, field, timeOutInSeconds);
    } else {//from  w w  w  . jav  a2  s . c  om
        return new DefaultElementLocator(driver, field);
    }
}