Search in sources :

Example 1 with ActionTitle

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

the class HTMLPage method setCheckBox.

/**
 * Find web element with corresponding title, if it is a check box, select
 * it If it's a WebElement instance, check whether it is already selected,
 * and click if it's not Add corresponding parameter to allure report
 *
 * @param elementTitle WebElement that is supposed to represent checkbox
 *
 * @throws PageException if page was not initialized, or required element
 *                                                           couldn't be found
 */
@ActionTitle("ru.sbtqa.tag.pagefactory.select.checkBox")
public void setCheckBox(String elementTitle) throws PageException {
    WebElement targetElement = getElementByTitle(this, elementTitle);
    if (targetElement.getClass().isAssignableFrom(CheckBox.class)) {
        ((CheckBox) targetElement).select();
    } else {
        setCheckBoxState(targetElement, true);
    }
    ParamsHelper.addParam(elementTitle, " is checked");
}
Also used : CheckBox(ru.yandex.qatools.htmlelements.element.CheckBox) WebElement(org.openqa.selenium.WebElement) ActionTitle(ru.sbtqa.tag.pagefactory.annotations.ActionTitle)

Example 2 with ActionTitle

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

the class WebElementsPage method pressKey.

/**
 * Press specified key on a keyboard Add corresponding parameter to allure
 * report
 *
 * @param keyName name of the key. See available key names in {@link Keys}
 */
@ActionTitle("ru.sbtqa.tag.pagefactory.press.key")
public void pressKey(String keyName) {
    Keys key = Keys.valueOf(keyName.toUpperCase());
    Actions actions = PageFactory.getActions();
    actions.sendKeys(key).perform();
    ParamsHelper.addParam(keyName, " is pressed");
}
Also used : Actions(org.openqa.selenium.interactions.Actions) ActionTitle(ru.sbtqa.tag.pagefactory.annotations.ActionTitle)

Example 3 with ActionTitle

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

the class IndexPage method openedPage.

@ActionTitle("opened page")
public void openedPage(String page) throws ElementDescriptionException, ElementNotFoundException {
    HtmlFindUtils htmlFindUtils = Environment.getFindUtils();
    List<Link> links = htmlFindUtils.findList(null, "menu with list elements->toolbar");
    String attributeClass = ElementUtils.getElementByText(links, page).findElement(By.xpath("./..")).getAttribute("class");
    Assert.assertEquals("The path to element was compiled incorrectly.", "active", attributeClass);
}
Also used : HtmlFindUtils(ru.sbtqa.tag.pagefactory.find.HtmlFindUtils) Link(ru.yandex.qatools.htmlelements.element.Link) ActionTitle(ru.sbtqa.tag.pagefactory.annotations.ActionTitle)

Example 4 with ActionTitle

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

the class ContactPage method findBlock.

@ActionTitle("check find block")
public void findBlock() {
    HtmlFindUtils htmlFindUtils = Environment.getFindUtils();
    checkType(htmlFindUtils.find("menu", MenuBlock.class), MenuBlock.class);
    checkType(htmlFindUtils.find("menu", HtmlElement.class), MenuBlock.class);
}
Also used : HtmlFindUtils(ru.sbtqa.tag.pagefactory.find.HtmlFindUtils) HtmlElement(ru.yandex.qatools.htmlelements.element.HtmlElement) MenuBlock(ru.sbtqa.tag.pagefactory.pages.htmlelements.blocks.MenuBlock) ActionTitle(ru.sbtqa.tag.pagefactory.annotations.ActionTitle)

Example 5 with ActionTitle

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

the class ContactPage method errNotContains.

@ActionTitle("check that error message not contains")
public void errNotContains(String message) {
    WebPageChecks checks = new WebPageChecks();
    Assert.assertFalse(checks.checkEquality(errorMsg, message, MatchStrategy.CONTAINS));
}
Also used : WebPageChecks(ru.sbtqa.tag.pagefactory.web.checks.WebPageChecks) ActionTitle(ru.sbtqa.tag.pagefactory.annotations.ActionTitle)

Aggregations

ActionTitle (ru.sbtqa.tag.pagefactory.annotations.ActionTitle)13 HtmlFindUtils (ru.sbtqa.tag.pagefactory.find.HtmlFindUtils)4 WebElement (org.openqa.selenium.WebElement)3 ArrayList (java.util.ArrayList)2 ActionTitles (ru.sbtqa.tag.pagefactory.annotations.ActionTitles)2 WebPageChecks (ru.sbtqa.tag.pagefactory.web.checks.WebPageChecks)2 TypifiedElement (ru.yandex.qatools.htmlelements.element.TypifiedElement)2 Button (com.epam.jdi.uitests.web.selenium.elements.common.Button)1 Input (com.epam.jdi.uitests.web.selenium.elements.common.Input)1 Actions (org.openqa.selenium.interactions.Actions)1 ElementNotFoundException (ru.sbtqa.tag.pagefactory.exceptions.ElementNotFoundException)1 PageException (ru.sbtqa.tag.pagefactory.exceptions.PageException)1 WaitException (ru.sbtqa.tag.pagefactory.exceptions.WaitException)1 MenuBlock (ru.sbtqa.tag.pagefactory.pages.htmlelements.blocks.MenuBlock)1 I18N (ru.sbtqa.tag.qautils.i18n.I18N)1 I18NRuntimeException (ru.sbtqa.tag.qautils.i18n.I18NRuntimeException)1 Button (ru.yandex.qatools.htmlelements.element.Button)1 CheckBox (ru.yandex.qatools.htmlelements.element.CheckBox)1 HtmlElement (ru.yandex.qatools.htmlelements.element.HtmlElement)1 Link (ru.yandex.qatools.htmlelements.element.Link)1