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;
}
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);
}
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();
}
}
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();
}
}
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();
}
}
Aggregations