Search in sources :

Example 1 with RadioButtonElement

use of com.seleniumtests.uipage.htmlelements.RadioButtonElement in project seleniumRobot by bhecquet.

the class TestFrameElement method testRadioButtonElementOutsideFrame.

@Test(groups = { "ut" })
public void testRadioButtonElementOutsideFrame() throws Exception {
    RadioButtonElement el = new RadioButtonElement("", By.id("el"));
    el.check();
    verify(locator, times(0)).frame(any(WebElement.class));
}
Also used : RadioButtonElement(com.seleniumtests.uipage.htmlelements.RadioButtonElement) WebElement(org.openqa.selenium.WebElement) RemoteWebElement(org.openqa.selenium.remote.RemoteWebElement) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 2 with RadioButtonElement

use of com.seleniumtests.uipage.htmlelements.RadioButtonElement in project seleniumRobot by bhecquet.

the class PageObject method assertNotChecked.

@GenericStep
public <T extends PageObject> T assertNotChecked(String fieldName) {
    Element element = getElement(fieldName);
    if (element instanceof CheckBoxElement || element instanceof RadioButtonElement) {
        Assert.assertTrue(((HtmlElement) element).isElementPresent(0), String.format(ERROR_ELEMENT_NOT_PRESENT, fieldName));
        Assert.assertFalse(((HtmlElement) element).isSelected(), String.format("Element %s is checked", fieldName));
    } else {
        throw new ScenarioException(String.format("Element %s is not an CheckBoxElement/RadioButtonElement", fieldName));
    }
    return (T) this;
}
Also used : WebElement(org.openqa.selenium.WebElement) HtmlElement(com.seleniumtests.uipage.htmlelements.HtmlElement) GenericPictureElement(com.seleniumtests.uipage.htmlelements.GenericPictureElement) RadioButtonElement(com.seleniumtests.uipage.htmlelements.RadioButtonElement) Element(com.seleniumtests.uipage.htmlelements.Element) CheckBoxElement(com.seleniumtests.uipage.htmlelements.CheckBoxElement) LinkElement(com.seleniumtests.uipage.htmlelements.LinkElement) RadioButtonElement(com.seleniumtests.uipage.htmlelements.RadioButtonElement) CheckBoxElement(com.seleniumtests.uipage.htmlelements.CheckBoxElement) ScenarioException(com.seleniumtests.customexception.ScenarioException)

Example 3 with RadioButtonElement

use of com.seleniumtests.uipage.htmlelements.RadioButtonElement in project seleniumRobot by bhecquet.

the class PageObject method assertChecked.

@GenericStep
public <T extends PageObject> T assertChecked(String fieldName) {
    Element element = getElement(fieldName);
    if (element instanceof CheckBoxElement || element instanceof RadioButtonElement) {
        Assert.assertTrue(((HtmlElement) element).isElementPresent(0), String.format(ERROR_ELEMENT_NOT_PRESENT, fieldName));
        Assert.assertTrue(((HtmlElement) element).isSelected(), String.format("Element %s is unchecked", fieldName));
    } else {
        throw new ScenarioException(String.format("Element %s is not an CheckBoxElement/RadioButtonElement", fieldName));
    }
    return (T) this;
}
Also used : WebElement(org.openqa.selenium.WebElement) HtmlElement(com.seleniumtests.uipage.htmlelements.HtmlElement) GenericPictureElement(com.seleniumtests.uipage.htmlelements.GenericPictureElement) RadioButtonElement(com.seleniumtests.uipage.htmlelements.RadioButtonElement) Element(com.seleniumtests.uipage.htmlelements.Element) CheckBoxElement(com.seleniumtests.uipage.htmlelements.CheckBoxElement) LinkElement(com.seleniumtests.uipage.htmlelements.LinkElement) RadioButtonElement(com.seleniumtests.uipage.htmlelements.RadioButtonElement) CheckBoxElement(com.seleniumtests.uipage.htmlelements.CheckBoxElement) ScenarioException(com.seleniumtests.customexception.ScenarioException)

Example 4 with RadioButtonElement

use of com.seleniumtests.uipage.htmlelements.RadioButtonElement in project seleniumRobot by bhecquet.

the class TestFrameElement method testRadioButtonElementInsideFrame.

@Test(groups = { "ut" })
public void testRadioButtonElementInsideFrame() throws Exception {
    FrameElement frame = new FrameElement("", By.id("frameId"));
    RadioButtonElement el = new RadioButtonElement("", By.id("el"), frame);
    el.check();
    verify(locator).frame(any(WebElement.class));
    verify(locator).defaultContent();
}
Also used : FrameElement(com.seleniumtests.uipage.htmlelements.FrameElement) RadioButtonElement(com.seleniumtests.uipage.htmlelements.RadioButtonElement) WebElement(org.openqa.selenium.WebElement) RemoteWebElement(org.openqa.selenium.remote.RemoteWebElement) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Aggregations

RadioButtonElement (com.seleniumtests.uipage.htmlelements.RadioButtonElement)4 WebElement (org.openqa.selenium.WebElement)4 MockitoTest (com.seleniumtests.MockitoTest)2 ScenarioException (com.seleniumtests.customexception.ScenarioException)2 CheckBoxElement (com.seleniumtests.uipage.htmlelements.CheckBoxElement)2 Element (com.seleniumtests.uipage.htmlelements.Element)2 GenericPictureElement (com.seleniumtests.uipage.htmlelements.GenericPictureElement)2 HtmlElement (com.seleniumtests.uipage.htmlelements.HtmlElement)2 LinkElement (com.seleniumtests.uipage.htmlelements.LinkElement)2 RemoteWebElement (org.openqa.selenium.remote.RemoteWebElement)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 Test (org.testng.annotations.Test)2 FrameElement (com.seleniumtests.uipage.htmlelements.FrameElement)1