Search in sources :

Example 11 with FrameElement

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

the class TestFrameElement method testUseElementInsideFrameRetryOnError.

@Test(groups = { "ut" })
public void testUseElementInsideFrameRetryOnError() throws Exception {
    FrameElement frame = new FrameElement("", By.id("frameId"));
    HtmlElement el = new HtmlElement("", By.id("el"), frame);
    Mockito.doThrow(new WebDriverException("fake exception")).doNothing().when(element).click();
    el.click();
    // 2 invocations because first call to click raises an error
    verify(locator, times(2)).frame(any(WebElement.class));
    verify(locator, times(2)).defaultContent();
}
Also used : HtmlElement(com.seleniumtests.uipage.htmlelements.HtmlElement) FrameElement(com.seleniumtests.uipage.htmlelements.FrameElement) WebElement(org.openqa.selenium.WebElement) RemoteWebElement(org.openqa.selenium.remote.RemoteWebElement) WebDriverException(org.openqa.selenium.WebDriverException) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 12 with FrameElement

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

the class TestFrameElement method testCheckBoxElementInsideFrame.

@Test(groups = { "ut" })
public void testCheckBoxElementInsideFrame() throws Exception {
    FrameElement frame = new FrameElement("", By.id("frameId"));
    CheckBoxElement el = new CheckBoxElement("", By.id("el"), frame);
    el.check();
    verify(locator, times(2)).frame(any(WebElement.class));
    verify(locator, times(2)).defaultContent();
}
Also used : FrameElement(com.seleniumtests.uipage.htmlelements.FrameElement) CheckBoxElement(com.seleniumtests.uipage.htmlelements.CheckBoxElement) 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 13 with FrameElement

use of com.seleniumtests.uipage.htmlelements.FrameElement 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)

Example 14 with FrameElement

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

the class TestFrameElement method testUseElementInsideFrameWithIndex.

/**
 * issue #276: Check that we can switch to a frame by index
 * @throws Exception
 */
@Test(groups = { "ut" })
public void testUseElementInsideFrameWithIndex() throws Exception {
    ArgumentCaptor<WebElement> frameArgument = ArgumentCaptor.forClass(WebElement.class);
    FrameElement frame = new FrameElement("", By.tagName("iframe"), 1);
    HtmlElement el = new HtmlElement("", By.id("el"), frame);
    el.click();
    verify(locator).frame(frameArgument.capture());
    Assert.assertEquals(frameArgument.getValue().getText(), "222");
    verify(locator).defaultContent();
}
Also used : HtmlElement(com.seleniumtests.uipage.htmlelements.HtmlElement) FrameElement(com.seleniumtests.uipage.htmlelements.FrameElement) 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 15 with FrameElement

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

the class TestFrameElement method testSelectListInsideFrame.

@Test(groups = { "ut" })
public void testSelectListInsideFrame() throws Exception {
    when(element.getTagName()).thenReturn("select");
    FrameElement frame = new FrameElement("", By.id("frameId"));
    SelectList el = new SelectList("", By.id("el"), frame);
    el.getSelectedText();
    verify(locator).frame(any(WebElement.class));
    verify(locator, times(1)).defaultContent();
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) FrameElement(com.seleniumtests.uipage.htmlelements.FrameElement) 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

FrameElement (com.seleniumtests.uipage.htmlelements.FrameElement)19 MockitoTest (com.seleniumtests.MockitoTest)16 WebElement (org.openqa.selenium.WebElement)16 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)16 Test (org.testng.annotations.Test)16 RemoteWebElement (org.openqa.selenium.remote.RemoteWebElement)15 HtmlElement (com.seleniumtests.uipage.htmlelements.HtmlElement)8 LinkElement (com.seleniumtests.uipage.htmlelements.LinkElement)2 RadioButtonElement (com.seleniumtests.uipage.htmlelements.RadioButtonElement)2 Around (org.aspectj.lang.annotation.Around)2 By (org.openqa.selenium.By)2 WebDriverException (org.openqa.selenium.WebDriverException)2 SeleniumTestsContextManager (com.seleniumtests.core.SeleniumTestsContextManager)1 TestStepManager (com.seleniumtests.core.TestStepManager)1 ScenarioException (com.seleniumtests.customexception.ScenarioException)1 BrowserType (com.seleniumtests.driver.BrowserType)1 CustomEventFiringWebDriver (com.seleniumtests.driver.CustomEventFiringWebDriver)1 DriverConfig (com.seleniumtests.driver.DriverConfig)1 DriverExceptionListener (com.seleniumtests.driver.DriverExceptionListener)1 TestType (com.seleniumtests.driver.TestType)1