Example usage for org.openqa.selenium.support.pagefactory Annotations isLookupCached

List of usage examples for org.openqa.selenium.support.pagefactory Annotations isLookupCached

Introduction

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

Prototype

@Override
public boolean isLookupCached() 

Source Link

Usage

From source file:com.arcbees.test.ElementLocator.java

License:Apache License

private void processAnnotations(Field field) {
    Annotations annotations = new Annotations(field);
    processFindBy(field, annotations);/*from w  ww  . ja v  a 2 s. co  m*/
    processWaitTimeout(field);
    shouldCache = annotations.isLookupCached();
}

From source file:com.oracle.pgbu.common.pagefactory.DefaultElementLocator.java

License:Apache License

/**
 * Creates a new element locator.//w  ww .j a  v a 2s.c  o m
 * 
 * @param searchContext
 *            The context to use when finding the element
 * @param field
 *            The field on the Page Object that will hold the located value
 */
public DefaultElementLocator(SearchContext searchContext, Field field) {
    this.searchContext = searchContext;
    Annotations annotations = new Annotations(field);
    shouldCache = annotations.isLookupCached();
    by = annotations.buildBy();
}

From source file:com.qmetry.qaf.automation.ui.webdriver.ElementFactory.java

License:Open Source License

@SuppressWarnings("unchecked")
public void initFields(Object classObj) {
    Field[] flds = ClassUtil.getAllFields(classObj.getClass(), AbstractTestPage.class);
    for (Field field : flds) {
        try {//  w w w  .j ava2s  .c  o m
            field.setAccessible(true);
            if (isDecoratable(field)) {
                Object value = null;
                if (hasAnnotation(field, FindBy.class, FindBys.class)) {
                    Annotations annotations = new Annotations(field);
                    boolean cacheElement = annotations.isLookupCached();
                    By by = annotations.buildBy();
                    if (List.class.isAssignableFrom(field.getType())) {
                        value = initList(by, context);
                    } else {
                        if (context instanceof WebElement) {
                            value = new QAFExtendedWebElement((QAFExtendedWebElement) context, by);
                        } else {
                            value = new QAFExtendedWebElement((QAFExtendedWebDriver) context, by, cacheElement);
                        }
                        initMetadata(classObj, field, (QAFExtendedWebElement) value);

                    }
                } else {
                    com.qmetry.qaf.automation.ui.annotations.FindBy findBy = field
                            .getAnnotation(com.qmetry.qaf.automation.ui.annotations.FindBy.class);
                    if (List.class.isAssignableFrom(field.getType())) {
                        value = initList(field, findBy.locator(), context, classObj);
                    } else {
                        if (QAFWebComponent.class.isAssignableFrom(field.getType())) {
                            value = ComponentFactory.getObject(field.getType(), findBy.locator(), classObj,
                                    context);

                        } else {
                            value = new QAFExtendedWebElement(findBy.locator());

                            if (context instanceof QAFExtendedWebElement) {
                                ((QAFExtendedWebElement) value).parentElement = (QAFExtendedWebElement) context;
                            }
                        }
                        initMetadata(classObj, field, (QAFExtendedWebElement) value);
                    }
                }

                field.set(classObj, value);
            }
        } catch (Exception e) {
            logger.error(e);
        }
    }
}

From source file:webdriver.elements.factory.UIElementLocator.java

License:Apache License

/**
 * Creates a new element locator.//  w ww .j a  v  a2s.com
 * 
 * @param searchContext The context to use when finding the element
 * @param field The field on the Page Object that will hold the located value
 */
public UIElementLocator(SearchContext searchContext, Field field) {
    this.searchContext = searchContext;
    Annotations annotations = new Annotations(field);
    shouldCache = annotations.isLookupCached();
    by = annotations.buildBy();
    //    ui = annotations.buildBy();
}