Search in sources :

Example 56 with CustomEventFiringWebDriver

use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.

the class DriverTestPageWithoutFixedPattern method move.

public void move() {
    CustomEventFiringWebDriver driver = (CustomEventFiringWebDriver) (getDriver());
    HtmlElement html = new HtmlElement("", By.tagName("html"));
    driver.manage().window().getPosition();
    driver.manage().window().getSize();
    driver.getViewPortDimensionWithoutScrollbar();
    new Actions(driver).moveToElement(html).moveByOffset(10, 100).click().perform();
    driver.getCurrentUrl();
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) Actions(org.openqa.selenium.interactions.Actions) HtmlElement(com.seleniumtests.uipage.htmlelements.HtmlElement)

Example 57 with CustomEventFiringWebDriver

use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.

the class TestPageObject method testResizeWindowHeadless.

@Test(groups = { "it" })
public void testResizeWindowHeadless() throws Exception {
    SeleniumTestsContextManager.getThreadContext().setBrowser("*htmlunit");
    driver = WebUIDriver.getWebDriver(true);
    new DriverTestPage(true);
    new DriverTestPage(true).resizeTo(600, 400);
    Dimension viewPortSize = ((CustomEventFiringWebDriver) driver).getViewPortDimensionWithoutScrollbar();
    Assert.assertEquals(viewPortSize.width, 600);
    Assert.assertEquals(viewPortSize.height, 400);
}
Also used : DriverTestPage(com.seleniumtests.it.driver.support.pages.DriverTestPage) CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) Dimension(org.openqa.selenium.Dimension) GenericDriverTest(com.seleniumtests.GenericDriverTest) Test(org.testng.annotations.Test)

Example 58 with CustomEventFiringWebDriver

use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.

the class TestCustomEventFiringWebDriver method testNullJavascriptReplyForContentDimension.

/**
 * check that if an error occurs during javascript invocation, window size is returned (issue #161)
 */
@Test(groups = { "ut" })
public void testNullJavascriptReplyForContentDimension() {
    Dimension dim = ((CustomEventFiringWebDriver) eventDriver).getContentDimension();
    // check we get the window dimension
    Assert.assertEquals(dim.height, 100);
    Assert.assertEquals(dim.width, 100);
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) Dimension(org.openqa.selenium.Dimension) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 59 with CustomEventFiringWebDriver

use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.

the class TestCustomEventFiringWebDriver method testNullJavascriptReplyForContentDimensionWithoutScrollbar.

/**
 * check that if an error occurs during javascript invocation, window size is returned (issue #161)
 */
@Test(groups = { "ut" })
public void testNullJavascriptReplyForContentDimensionWithoutScrollbar() {
    Dimension dim = ((CustomEventFiringWebDriver) eventDriver).getViewPortDimensionWithoutScrollbar();
    // check we get the window dimension
    Assert.assertEquals(dim.height, 100);
    Assert.assertEquals(dim.width, 100);
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) Dimension(org.openqa.selenium.Dimension) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 60 with CustomEventFiringWebDriver

use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.

the class TestCustomEventFiringWebDriver method testViewPortDimensionWithoutScrollbarNotGet.

/**
 * issue #238: check that if at least 1 dimension is the max one, switch to default content to retrieve it
 */
@Test(groups = { "ut" })
public void testViewPortDimensionWithoutScrollbarNotGet() {
    // retry when getting width
    when(driver.executeScript(anyString(), eq(true))).thenReturn(100000L).thenReturn(120L).thenReturn(80L);
    Dimension dim = ((CustomEventFiringWebDriver) eventDriver).getViewPortDimensionWithoutScrollbar();
    verify(driver).switchTo();
    // check we get the window dimension
    Assert.assertEquals(dim.height, 80);
    Assert.assertEquals(dim.width, 120);
}
Also used : CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) Dimension(org.openqa.selenium.Dimension) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

CustomEventFiringWebDriver (com.seleniumtests.driver.CustomEventFiringWebDriver)77 Test (org.testng.annotations.Test)53 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)36 MockitoTest (com.seleniumtests.MockitoTest)35 Dimension (org.openqa.selenium.Dimension)26 WebDriver (org.openqa.selenium.WebDriver)14 GenericDriverTest (com.seleniumtests.GenericDriverTest)12 Point (org.openqa.selenium.Point)12 GenericTest (com.seleniumtests.GenericTest)10 ScenarioException (com.seleniumtests.customexception.ScenarioException)9 WebDriverException (org.openqa.selenium.WebDriverException)7 BeforeMethod (org.testng.annotations.BeforeMethod)7 DriverExceptionListener (com.seleniumtests.driver.DriverExceptionListener)6 SkipException (org.testng.SkipException)6 NLWebDriver (com.neotys.selenium.proxies.NLWebDriver)5 File (java.io.File)5 IOException (java.io.IOException)5 Rectangle (org.openqa.selenium.Rectangle)5 WebElement (org.openqa.selenium.WebElement)5 BrowserInfo (com.seleniumtests.browserfactory.BrowserInfo)4