public MobilePlatform definedContext() { String targetPlatform = environmentVariables.getProperty("context","NONE"); try { return MobilePlatform.valueOf(targetPlatform.toUpperCase()); } catch (IllegalArgumentException e) { LOGGER.debug("The provided context ({}) could not be used as the MobilePlatform", targetPlatform); } return MobilePlatform.NONE; }
if (androidBy != null && ANDROID.toUpperCase().equals(platform.name())) { by = getMobileBy(androidBy, getFilledValue(androidBy)); if (androidBys != null && ANDROID.toUpperCase().equals(platform.name())) { by = getComplexMobileBy(androidBys.value(), ByChained.class); if (iOSBy != null && IOS.toUpperCase().equals(platform.name())) { by = getMobileBy(iOSBy, getFilledValue(iOSBy)); if (iOSBys != null && IOS.toUpperCase().equals(platform.name())) { by = getComplexMobileBy(iOSBys.value(), ByChained.class);
if (androidBy != null && ANDROID.toUpperCase().equals(platform.name())) { by = getMobileBy(androidBy, getFieldValue(androidBy)); if (androidBys != null && ANDROID.toUpperCase().equals(platform.name())) { by = getComplexMobileBy(androidBys.value(), ByChained.class); if (androidFindAll != null && ANDROID.toUpperCase().equals(platform.name())) { by = getComplexMobileBy(androidFindAll.value(), ByChained.class); if (iOSBy != null && IOS.toUpperCase().equals(platform.name())) { by = getMobileBy(iOSBy, getFieldValue(iOSBy)); if (iOSBys != null && IOS.toUpperCase().equals(platform.name())) { by = getComplexMobileBy(iOSBys.value(), ByChained.class); if (iOSFindAll != null && IOS.toUpperCase().equals(platform.name())) { by = getComplexMobileBy(iOSFindAll.value(), ByChained.class);
public WebDriver newAppiumDriver(URL hub, Capabilities capabilities, MobilePlatform platform) { switch (platform) { case ANDROID: AndroidDriver androidDriver = new AndroidDriver(hub, capabilities); driverProperties.registerCapabilities("appium", androidDriver.getCapabilities()); return androidDriver; case IOS: IOSDriver iosDriver = new IOSDriver(hub, capabilities); driverProperties.registerCapabilities("appium", iosDriver.getCapabilities()); return iosDriver; } throw new UnsupportedDriverException(platform.name()); }
/** * Return the Appium platform defined in the system properties, or NONE if no platform is defined. */ public MobilePlatform definedTargetPlatform() { String targetPlatform = environmentVariables.getProperty("appium.platformName","NONE"); try { return MobilePlatform.valueOf(targetPlatform.toUpperCase()); } catch (IllegalArgumentException e) { throw new ThucydidesConfigurationException("Illegal appium.platformName value (needs to be either IOS or ANDROID):" + targetPlatform); } }
return iosDriver; throw new UnsupportedDriverException(appiumTargetPlatform(testEnvironmentVariables).name());
public MobilePlatform getTargetPlatform() { String targetPlatform = environmentVariables.getProperty("appium.platformName", "UNDEFINED"); MobilePlatform platform = null; try { platform = MobilePlatform.valueOf(targetPlatform.toUpperCase()); } catch (IllegalArgumentException e) { throw new ThucydidesConfigurationException("The appium.platformName needs to be specified (either IOS or ANDROID)"); } return platform; }
private WebDriver newDriverUsingExternalServer(String options, EnvironmentVariables environmentVariables) { CapabilityEnhancer enhancer = new CapabilityEnhancer(environmentVariables, fixtureProviderService); if (StepEventBus.getEventBus().webdriverCallsAreSuspended()) { return new WebDriverStub(); } switch (appiumTargetPlatform(environmentVariables)) { case ANDROID: AndroidDriver androidDriver = new AndroidDriver(appiumUrl(environmentVariables), enhancer.enhanced(appiumCapabilities(options,environmentVariables), ANDROID) ); driverProperties.registerCapabilities("appium", capabilitiesToProperties(androidDriver.getCapabilities())); return androidDriver; case IOS: IOSDriver iosDriver = new IOSDriver(appiumUrl(environmentVariables), enhancer.enhanced(appiumCapabilities(options,environmentVariables), IPHONE)); driverProperties.registerCapabilities("appium", capabilitiesToProperties(iosDriver.getCapabilities())); return iosDriver; } throw new UnsupportedDriverException(appiumTargetPlatform(environmentVariables).name()); }
/** * Define the platform based on the {@link DesiredCapabilities} of the {@link WebDriver} first. If that doesn't * work, fall back to the Appium platform defined in the system properties or the context. * Must be either ios or android. */ public MobilePlatform getTargetPlatform(WebDriver driver) { try { return MobilePlatform.valueOf(((RemoteWebDriver) driver).getCapabilities().getPlatform().name()); } catch (IllegalArgumentException e) { LOGGER.debug("Platform was not a MobilePlatform:", e); } return getTargetPlatform(); }