use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.
the class SauceLabsDriverFactory method createNativeDriver.
@Override
protected WebDriver createNativeDriver() {
MutableCapabilities capabilities = createCapabilities();
capabilities.merge(driverOptions);
try {
if (ANDROID_PLATFORM.equalsIgnoreCase(webDriverConfig.getPlatform())) {
return new AndroidDriver<WebElement>(new URL(webDriverConfig.getHubUrl().get(0)), capabilities);
} else if ("ios".equalsIgnoreCase(webDriverConfig.getPlatform())) {
return new IOSDriver<WebElement>(new URL(webDriverConfig.getHubUrl().get(0)), capabilities);
} else {
return new RemoteWebDriver(new URL(webDriverConfig.getHubUrl().get(0)), capabilities);
}
} catch (MalformedURLException e) {
throw new DriverExceptions("Error creating driver: " + e.getMessage());
}
}
use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.
the class BrowserStackDriverFactory method createNativeDriver.
@Override
protected WebDriver createNativeDriver() {
MutableCapabilities capabilities = createCapabilities();
capabilities.merge(driverOptions);
try {
return new RemoteWebDriver(new URL(webDriverConfig.getHubUrl().get(0)), capabilities);
} catch (MalformedURLException e) {
throw new DriverExceptions("Error creating driver: " + e.getMessage());
}
}
use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.
the class HtmlElement method getUnderlyingElement.
/*
* Methods for mobile actions only
*/
/**
* findElement returns a EventFiringWebElement which is not compatible with
* MobileElement Get the unerlying element and return it
*/
private WebElement getUnderlyingElement(WebElement localElement) {
if (localElement.getClass().getName().contains("EventFiringWebElement")) {
try {
Method getWrappedElementMethod = localElement.getClass().getDeclaredMethod("getWrappedElement");
getWrappedElementMethod.setAccessible(true);
return (WebElement) getWrappedElementMethod.invoke(localElement);
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new DriverExceptions("cannot get wrapped Element", e);
}
} else {
return localElement;
}
}
use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.
the class AppiumDriverFactory method createNativeDriver.
@Override
protected WebDriver createNativeDriver() {
// start appium
appiumLauncher = AppiumLauncherFactory.getInstance();
appiumLauncher.startAppium();
try {
MutableCapabilities capabilities = getMobileCapabilities();
if (ANDROID_PLATORM.equalsIgnoreCase(webDriverConfig.getPlatform())) {
extractAndroidDriver(capabilities);
return new AndroidDriver<WebElement>(new URL(appiumLauncher.getAppiumServerUrl()), capabilities);
} else if ("ios".equalsIgnoreCase(webDriverConfig.getPlatform())) {
return new IOSDriver<WebElement>(new URL(appiumLauncher.getAppiumServerUrl()), capabilities);
} else {
throw new ConfigurationException(String.format("Platform %s is unknown for Appium tests", webDriverConfig.getPlatform()));
}
} catch (MalformedURLException e) {
throw new DriverExceptions("Error creating driver: " + e.getMessage());
}
}
use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.
the class StubTestClass method testWithExceptionOnFirstExec.
/**
* Test which fails only on first execution
*/
@Test(groups = "stub")
public void testWithExceptionOnFirstExec() {
TestStep step1 = new TestStep("step 10", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
step1.addAction(new TestAction(String.format("played %d times", count), false, new ArrayList<>()));
step1.addAction(new TestAction("click button", false, new ArrayList<>()));
TestStepManager.logTestStep(step1);
if (!failed) {
failed = true;
throw new DriverExceptions("some exception");
}
}
Aggregations