Search in sources :

Example 1 with Page

use of ru.sbtqa.tag.pagefactory.Page in project page-factory-2 by sbtqa.

the class WebStepsImpl method putElementValueInStash.

public T putElementValueInStash(String elementName, String variableName) throws PageException {
    Page currentPage = PageContext.getCurrentPage();
    WebElement element = Environment.getFindUtils().getElementByTitle(currentPage, elementName);
    Stash.put(variableName, ElementUtils.getWebElementValue(element));
    return (T) this;
}
Also used : Page(ru.sbtqa.tag.pagefactory.Page) WebElement(org.openqa.selenium.WebElement)

Example 2 with Page

use of ru.sbtqa.tag.pagefactory.Page in project page-factory-2 by sbtqa.

the class HtmlFindUtils method getField.

private Field getField(Object element, String elementName) {
    Page page = PageContext.getCurrentPage();
    Class clazz = element == null ? page.getClass() : element.getClass();
    for (Field field : FieldUtilsExt.getFieldsListWithAnnotation(clazz, ElementTitle.class)) {
        field.setAccessible(true);
        if (field.getAnnotation(ElementTitle.class).value().equals(elementName)) {
            return field;
        }
    }
    return null;
}
Also used : Field(java.lang.reflect.Field) Page(ru.sbtqa.tag.pagefactory.Page)

Aggregations

Page (ru.sbtqa.tag.pagefactory.Page)2 Field (java.lang.reflect.Field)1 WebElement (org.openqa.selenium.WebElement)1