Search in sources :

Example 6 with HtmlFindUtils

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

the class ContactPage method findWebElement.

@ActionTitle("check find web element")
public void findWebElement() {
    HtmlFindUtils htmlFindUtils = Environment.getFindUtils();
    WebElement webElement = htmlFindUtils.find("send", WebElement.class);
    Assert.assertFalse("Incorrect type", webElement.getClass().isAssignableFrom(TypifiedElement.class));
    checkType(htmlFindUtils.find("send", Button.class), Button.class);
}
Also used : HtmlFindUtils(ru.sbtqa.tag.pagefactory.find.HtmlFindUtils) Button(ru.yandex.qatools.htmlelements.element.Button) WebElement(org.openqa.selenium.WebElement) TypifiedElement(ru.yandex.qatools.htmlelements.element.TypifiedElement) ActionTitle(ru.sbtqa.tag.pagefactory.annotations.ActionTitle)

Example 7 with HtmlFindUtils

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

the class ContactPage method findTypifiedElement.

@ActionTitle("check find typified element")
public void findTypifiedElement() {
    HtmlFindUtils htmlFindUtils = Environment.getFindUtils();
    checkType(htmlFindUtils.find("first name", TypifiedElement.class), TextInput.class);
    checkType(htmlFindUtils.find("first name", TextInput.class), TextInput.class);
    checkType(htmlFindUtils.find("first name", WebElement.class), TextInput.class);
}
Also used : HtmlFindUtils(ru.sbtqa.tag.pagefactory.find.HtmlFindUtils) TextInput(ru.yandex.qatools.htmlelements.element.TextInput) WebElement(org.openqa.selenium.WebElement) TypifiedElement(ru.yandex.qatools.htmlelements.element.TypifiedElement) ActionTitle(ru.sbtqa.tag.pagefactory.annotations.ActionTitle)

Example 8 with HtmlFindUtils

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

the class HtmlReflection method executeMethodByTitleInBlock.

/**
 * Execute method with one or more parameters inside of the given block
 * element
 *
 * @param blockPath block title, or a block chain string separated with
 * {@code ->} symbols
 * @param actionTitle title of the action to execute
 * @param parameters parameters that will be passed to method
 */
public void executeMethodByTitleInBlock(String blockPath, String actionTitle, Object... parameters) {
    try {
        HtmlElement block = ((HtmlFindUtils) Environment.getFindUtils()).find(blockPath, HtmlElement.class);
        executeMethodByTitle(block, actionTitle, parameters);
    } catch (ElementSearchError ex) {
        throw new ElementSearchError(format("Block not found by path '%s'", blockPath), ex);
    }
}
Also used : HtmlFindUtils(ru.sbtqa.tag.pagefactory.find.HtmlFindUtils) ElementSearchError(ru.sbtqa.tag.pagefactory.exception.ElementSearchError) HtmlElement(ru.yandex.qatools.htmlelements.element.HtmlElement)

Aggregations

HtmlFindUtils (ru.sbtqa.tag.pagefactory.find.HtmlFindUtils)8 WebElement (org.openqa.selenium.WebElement)5 ActionTitle (ru.sbtqa.tag.pagefactory.annotations.ActionTitle)4 HtmlElement (ru.yandex.qatools.htmlelements.element.HtmlElement)2 TypifiedElement (ru.yandex.qatools.htmlelements.element.TypifiedElement)2 Field (java.lang.reflect.Field)1 FindBy (org.openqa.selenium.support.FindBy)1 ElementTitle (ru.sbtqa.tag.pagefactory.annotations.ElementTitle)1 BaseElement (ru.sbtqa.tag.pagefactory.elements.BaseElement)1 ElementSearchError (ru.sbtqa.tag.pagefactory.exception.ElementSearchError)1 ElementDescriptionException (ru.sbtqa.tag.pagefactory.exceptions.ElementDescriptionException)1 ElementNotFoundException (ru.sbtqa.tag.pagefactory.exceptions.ElementNotFoundException)1 MenuBlock (ru.sbtqa.tag.pagefactory.pages.htmlelements.blocks.MenuBlock)1 HtmlElementUtils.getWebElement (ru.sbtqa.tag.pagefactory.utils.HtmlElementUtils.getWebElement)1 AutotestError (ru.sbtqa.tag.qautils.errors.AutotestError)1 Button (ru.yandex.qatools.htmlelements.element.Button)1 Link (ru.yandex.qatools.htmlelements.element.Link)1 TextInput (ru.yandex.qatools.htmlelements.element.TextInput)1