Search in sources :

Example 21 with CustomEventFiringWebDriver

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

the class PictureElement method doAfterPictureSearch.

protected void doAfterPictureSearch() {
    // scroll to element where our picture is so that we will be able to act on it
    // scrolling will display, on top of window, the top of the element
    intoElement.scrollToElement(0);
    WaitHelper.waitForMilliSeconds(500);
    WebUIDriver uiDriver = isDriverCreated();
    double pixelAspectRatio = ((CustomEventFiringWebDriver) uiDriver.getDriver()).getDeviceAspectRatio();
    // take into account the aspect ratio
    detectedObjectRectangle.x = (int) (detectedObjectRectangle.x / pixelAspectRatio);
    detectedObjectRectangle.y = (int) (detectedObjectRectangle.y / pixelAspectRatio);
    detectedObjectRectangle.width = (int) (detectedObjectRectangle.width / pixelAspectRatio);
    detectedObjectRectangle.height = (int) (detectedObjectRectangle.height / pixelAspectRatio);
    pictureSizeRatio = pictureSizeRatio / pixelAspectRatio;
}
Also used : WebUIDriver(com.seleniumtests.driver.WebUIDriver) CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver)

Example 22 with CustomEventFiringWebDriver

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

the class TestWebUiDriver method testMultipleBrowserCreation.

@Test(groups = { "it" })
public void testMultipleBrowserCreation() {
    SeleniumTestsContextManager.getThreadContext().setTestType(TestType.WEB);
    // creates the first driver
    WebDriver driver1 = WebUIDriver.getWebDriver(true, BrowserType.CHROME, "main", null);
    driver1.get("chrome://settings/");
    // creates the second driver
    WebDriver driver2 = WebUIDriver.getWebDriver(true, BrowserType.FIREFOX, "second", null);
    driver2.get("about:config");
    // last created driver has the focus
    Assert.assertEquals(WebUIDriver.getWebDriver(false), driver2);
    // created browser is of the requested type
    Assert.assertTrue(((CustomEventFiringWebDriver) driver1).getWebDriver() instanceof ChromeDriver);
    Assert.assertTrue(((CustomEventFiringWebDriver) driver2).getWebDriver() instanceof FirefoxDriver);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) Test(org.testng.annotations.Test) GenericDriverTest(com.seleniumtests.GenericDriverTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) ReporterTest(com.seleniumtests.it.reporter.ReporterTest)

Example 23 with CustomEventFiringWebDriver

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

the class TestCustomEventFiringWebDriver method testHtmlUnitDriverClosed.

@Test(groups = { "it" })
public void testHtmlUnitDriverClosed() {
    if (!installedBrowsers.contains(BrowserType.HTMLUNIT)) {
        throw new SkipException("browser not found");
    }
    WebDriver driver = WebUIDriver.getWebDriver(true, BrowserType.HTMLUNIT, "main", null);
    try {
        Assert.assertFalse(((CustomEventFiringWebDriver) driver).isBrowserClosed());
        driver.close();
        Assert.assertTrue(((CustomEventFiringWebDriver) driver).isBrowserClosed());
    } finally {
        driver.quit();
    }
}
Also used : WebDriver(org.openqa.selenium.WebDriver) CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) SkipException(org.testng.SkipException) GenericDriverTest(com.seleniumtests.GenericDriverTest) Test(org.testng.annotations.Test)

Example 24 with CustomEventFiringWebDriver

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

the class TestCustomEventFiringWebDriver method testChromeDriverClosed.

@Test(groups = { "it" })
public void testChromeDriverClosed() {
    if (!installedBrowsers.contains(BrowserType.CHROME)) {
        throw new SkipException("browser not found");
    }
    WebDriver driver = WebUIDriver.getWebDriver(true, BrowserType.CHROME, "main", null);
    try {
        Assert.assertFalse(((CustomEventFiringWebDriver) driver).isBrowserClosed());
        driver.close();
        Assert.assertTrue(((CustomEventFiringWebDriver) driver).isBrowserClosed());
    } finally {
        driver.quit();
    }
}
Also used : WebDriver(org.openqa.selenium.WebDriver) CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) SkipException(org.testng.SkipException) GenericDriverTest(com.seleniumtests.GenericDriverTest) Test(org.testng.annotations.Test)

Example 25 with CustomEventFiringWebDriver

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

the class TestCustomEventFiringWebDriver method testFirefoxDriverClosed.

@Test(groups = { "it" })
public void testFirefoxDriverClosed() {
    if (!installedBrowsers.contains(BrowserType.FIREFOX)) {
        throw new SkipException("browser not found");
    }
    WebDriver driver = WebUIDriver.getWebDriver(true, BrowserType.FIREFOX, "main", null);
    try {
        Assert.assertFalse(((CustomEventFiringWebDriver) driver).isBrowserClosed());
        driver.close();
        Assert.assertTrue(((CustomEventFiringWebDriver) driver).isBrowserClosed());
    } finally {
        driver.quit();
    }
}
Also used : WebDriver(org.openqa.selenium.WebDriver) CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) SkipException(org.testng.SkipException) GenericDriverTest(com.seleniumtests.GenericDriverTest) Test(org.testng.annotations.Test)

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