diff --git a/htmlelements-java/pom.xml b/htmlelements-java/pom.xml index e87d7dce..fd5c797c 100644 --- a/htmlelements-java/pom.xml +++ b/htmlelements-java/pom.xml @@ -12,7 +12,7 @@ Yandex QATools HtmlElements For Java - 2.53.0 + 3.5.1 0.7 1.9.8 diff --git a/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/loader/decorator/HtmlElementClassAnnotationsHandler.java b/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/loader/decorator/HtmlElementClassAnnotationsHandler.java index b5519c13..2326c819 100644 --- a/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/loader/decorator/HtmlElementClassAnnotationsHandler.java +++ b/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/loader/decorator/HtmlElementClassAnnotationsHandler.java @@ -2,7 +2,9 @@ import org.openqa.selenium.By; import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.FindBy.FindByBuilder; import org.openqa.selenium.support.pagefactory.AbstractAnnotations; + import ru.yandex.qatools.htmlelements.element.HtmlElement; import ru.yandex.qatools.htmlelements.exceptions.HtmlElementsException; @@ -24,7 +26,7 @@ public By buildBy() { Class clazz = elementClass; while (clazz != Object.class) { if (clazz.isAnnotationPresent(FindBy.class)) { - return buildByFromFindBy(clazz.getAnnotation(FindBy.class)); + return new FindByBuilder().buildIt(clazz.getAnnotation(FindBy.class), null); } clazz = clazz.getSuperclass(); } diff --git a/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/loader/decorator/HtmlElementFieldAnnotationsHandler.java b/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/loader/decorator/HtmlElementFieldAnnotationsHandler.java index dc7a974c..21aff5db 100644 --- a/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/loader/decorator/HtmlElementFieldAnnotationsHandler.java +++ b/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/loader/decorator/HtmlElementFieldAnnotationsHandler.java @@ -1,21 +1,22 @@ package ru.yandex.qatools.htmlelements.loader.decorator; +import java.lang.reflect.Field; + import org.openqa.selenium.By; import org.openqa.selenium.support.FindAll; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBys; import org.openqa.selenium.support.pagefactory.Annotations; -import ru.yandex.qatools.htmlelements.exceptions.HtmlElementsException; -import java.lang.reflect.Field; +import ru.yandex.qatools.htmlelements.exceptions.HtmlElementsException; import static ru.yandex.qatools.htmlelements.utils.HtmlElementUtils.*; /** - * Extends default field annotations handling mechanism with processing annotation for blocks and lists of blocks. + * Extends default field annotations handling mechanism with processing + * annotation for blocks and lists of blocks. * - * @author Alexander Tolmachev starlight@yandex-team.ru - * Date: 15.08.12 + * @author Alexander Tolmachev starlight@yandex-team.ru Date: 15.08.12 */ public class HtmlElementFieldAnnotationsHandler extends Annotations { public HtmlElementFieldAnnotationsHandler(Field field) { @@ -36,17 +37,17 @@ public By buildBy() { private By buildByFromFindAnnotations() { if (getField().isAnnotationPresent(FindBys.class)) { FindBys findBys = getField().getAnnotation(FindBys.class); - return buildByFromFindBys(findBys); + return new FindBys.FindByBuilder().buildIt(findBys, null); } if (getField().isAnnotationPresent(FindAll.class)) { - FindAll findBys = getField().getAnnotation(FindAll.class); - return buildBysFromFindByOneOf(findBys); + FindAll findAll = getField().getAnnotation(FindAll.class); + return new FindAll.FindByBuilder().buildIt(findAll, null); } if (getField().isAnnotationPresent(FindBy.class)) { FindBy findBy = getField().getAnnotation(FindBy.class); - return buildByFromFindBy(findBy); + return new FindBy.FindByBuilder().buildIt(findBy, null); } return null; } @@ -62,7 +63,7 @@ private By buildByFromHtmlElementAnnotations() { Class fieldClass = getField().getType(); while (fieldClass != Object.class) { if (fieldClass.isAnnotationPresent(FindBy.class)) { - return buildByFromFindBy(fieldClass.getAnnotation(FindBy.class)); + return new FindBy.FindByBuilder().buildIt(fieldClass.getAnnotation(FindBy.class), null); } fieldClass = fieldClass.getSuperclass(); } @@ -81,7 +82,7 @@ private By buildByFromHtmlElementListAnnotations() { Class listParameterClass = getGenericParameterClass(getField()); while (listParameterClass != Object.class) { if (listParameterClass.isAnnotationPresent(FindBy.class)) { - return buildByFromFindBy(listParameterClass.getAnnotation(FindBy.class)); + return new FindBy.FindByBuilder().buildIt(listParameterClass.getAnnotation(FindBy.class), null); } listParameterClass = listParameterClass.getSuperclass(); }