use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class TestBrowserStackDriverFactory method testBrowserStack.
/**
* For this test to run, you must add the following JVM parameters
* -Dapp=<application.apk>
* -DappPackage=<package>
* -DappActivity=<activity>
* -DappWaitActivity=<waitActivity> # if any
* -DwebDriverGrid=https://<user>:<key>@hub.browserstack.com/wd/hub
* -Dhttps.proxyHost=<proxy_host> -Dhttps.proxyPort=<proxy_port>
*/
@Test(groups = "no-test")
public void testBrowserStack() {
SeleniumTestsContextManager.getThreadContext().setTestType(TestType.APPIUM_APP_ANDROID);
SeleniumTestsContextManager.getThreadContext().setPlatform("android 11.0");
SeleniumTestsContextManager.getThreadContext().setDeviceName("Google Pixel 4");
SeleniumTestsContextManager.getThreadContext().setRunMode("browserstack");
SeleniumTestsContextManager.getThreadContext().configureContext(Reporter.getCurrentTestResult());
WebDriver driver = WebUIDriver.getWebDriver(true);
WebDriver realDriver = ((CustomEventFiringWebDriver) driver).getWebDriver();
driver.findElements(By.xpath("//*")).get(0).getText();
}
use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class TestSauceLabsDriverFactory method testSauceLabs.
/**
* For this test to run, you must add the following JVM parameters
* -Dapp=<application.apk>
* -DappPackage=<package>
* -DappActivity=<activity>
* -DappWaitActivity=<waitActivity> # if any
* -DwebDriverGrid=https://<user>:<key>@ondemand.eu-central-1.saucelabs.com:443/wd/hub
* -Dhttps.proxyHost=<proxy_host> -Dhttps.proxyPort=<proxy_port>
*/
@Test(groups = "no-test")
public void testSauceLabs() {
SeleniumTestsContextManager.getThreadContext().setTestType(TestType.APPIUM_APP_ANDROID);
SeleniumTestsContextManager.getThreadContext().setPlatform("android 11");
SeleniumTestsContextManager.getThreadContext().setDeviceName(".*google.*");
SeleniumTestsContextManager.getThreadContext().setRunMode("saucelabs");
SeleniumTestsContextManager.getThreadContext().configureContext(Reporter.getCurrentTestResult());
WebDriver driver = WebUIDriver.getWebDriver(true);
WebDriver realDriver = ((CustomEventFiringWebDriver) driver).getWebDriver();
}
use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class UiElement method getDriver.
public CustomEventFiringWebDriver getDriver() {
WebUIDriver uiDriver = WebUIDriver.getWebUIDriver(false);
if (uiDriver == null) {
throw new ScenarioException("Driver has not already been created");
}
CustomEventFiringWebDriver driver = (CustomEventFiringWebDriver) uiDriver.getDriver();
if (driver == null) {
throw new ScenarioException("Driver has not already been created");
}
return driver;
}
use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class TestPageObject method testResizeWindow.
@Test(groups = { "it" })
public void testResizeWindow() throws Exception {
SeleniumTestsContextManager.getThreadContext().setBrowser("*firefox");
driver = WebUIDriver.getWebDriver(true);
new DriverTestPage(true).resizeTo(600, 400);
Dimension viewPortSize = ((CustomEventFiringWebDriver) driver).getViewPortDimensionWithoutScrollbar();
Assert.assertEquals(viewPortSize.width, 600);
Assert.assertEquals(viewPortSize.height, 400);
}
use of com.seleniumtests.driver.CustomEventFiringWebDriver in project seleniumRobot by bhecquet.
the class PageObject method resizeTo.
/**
* Resize window to given dimensions.
*
* @param width
* @param height
*/
public final void resizeTo(final int width, final int height) {
// app test are not compatible with window
if (SeleniumTestsContextManager.isAppTest()) {
return;
}
try {
Dimension setSize = new Dimension(width, height);
driver.manage().window().setPosition(new Point(0, 0));
int retries = 5;
for (int i = 0; i < retries; i++) {
driver.manage().window().setSize(setSize);
Dimension viewPortSize = ((CustomEventFiringWebDriver) driver).getViewPortDimensionWithoutScrollbar();
if (viewPortSize.height == height && viewPortSize.width == width) {
break;
} else {
setSize = new Dimension(2 * width - viewPortSize.width, 2 * height - viewPortSize.height);
}
}
} catch (Exception ex) {
internalLogger.error(ex);
}
}
Aggregations