List of usage examples for org.openqa.selenium.remote CapabilityType BROWSER_NAME
String BROWSER_NAME
To view the source code for org.openqa.selenium.remote CapabilityType BROWSER_NAME.
Click Source Link
From source file:com.ecofactor.qa.automation.platform.ops.impl.AbstractDriverOperations.java
License:Open Source License
/** * Sets the hub capabilities.//from ww w .ja v a 2s . co m * @param capabilities the new hub capabilities */ protected void setHubCapabilities(final DesiredCapabilities capabilities) { capabilities.setCapability(CapabilityType.BROWSER_NAME, getDeviceName()); if (hasPlatformParam()) { capabilities.setCapability(CapabilityType.PLATFORM, getPlatformName()); } if (hasVersionParam()) { capabilities.setCapability(CapabilityType.VERSION, getVersion()); } }
From source file:com.ecofactor.qa.automation.platform.ops.impl.IOSOperations.java
License:Open Source License
/** * Creates the device driver.//w ww . jav a 2s . co m * @return the web driver * @throws DeviceException the device exception * @see com.ecofactor.qa.automation.mobile.ops.impl.AbstractMobileOperations#createDeviceDriver() */ @Override protected WebDriver createDeviceDriver() throws DeviceException { WebDriver driver = null; if (!hasErrors) { try { final File classpathRoot = new File(System.getProperty("user.dir")); final File app = new File(classpathRoot, "/EcoFactor_iOS/EcoFactorNew.zip"); setLogString("Application Path: " + app.getPath(), true); final DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("device", "iphone"); capabilities.setCapability(CapabilityType.BROWSER_NAME, JenkinsParamUtil.getDeviceName()); capabilities.setCapability(CapabilityType.VERSION, "7.0"); capabilities.setCapability(CapabilityType.PLATFORM, SystemUtil.getOSType()); capabilities.setCapability("cleanSession", true); capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true); driver = new SwipeableWebDriver(new URL(getAppiumHostUrl()), capabilities); } catch (Exception ex) { if (ex.getCause() instanceof HttpHostConnectException) { setErrorMsg("Appium not started"); setLogString(errorMsg, true); hasErrors = true; throw new DeviceException("\033[41;1m" + getErrorMsg()); } setLogString("\033[41;1mERROR in initialze (" + ex.getMessage() + ")", true); throw new DeviceException("ERROR in initialze (" + ex.getMessage() + ")"); } } return driver; }
From source file:com.ecofactor.qa.automation.platform.util.SeleniumDriverUtil.java
License:Open Source License
/** * Creates the android driver./*w w w . j a va2s . c o m*/ * @param deviceType the device type * @return the web driver * @throws DeviceException the device exception */ public static WebDriver createAndroidDriver(final boolean deviceType) throws DeviceException { if (!hasErrors) { try { setLogString(LogSection.START, deviceType ? "Uninstalling App" : "Installing App", true); final File app = getAppPath(); setLogString("App Location : " + app.getPath(), true); final DesiredCapabilities capabilities = setDriverCapabilities(deviceType, app); capabilities.setCapability(CapabilityType.BROWSER_NAME, getDeviceName()); setLogString("Launch webdriver", true); final WebDriver driver = new SwipeableWebDriver(new URL(createHostUrl()), capabilities); setLogString(LogSection.END, "App Process Completed", true); return driver; } catch (final Exception ex) { checkIfAppiumError(ex); } } return null; }
From source file:com.ecofactor.qa.automation.platform.util.SeleniumDriverUtil.java
License:Open Source License
/** * Creates the ios driver./* ww w .java 2s.c o m*/ * @return the web driver * @throws DeviceException the device exception */ public static WebDriver createIOSDriver() throws DeviceException { WebDriver driver = null; if (!hasErrors) { try { final File classpathRoot = new File(System.getProperty("user.dir")); final File app = new File(classpathRoot, ECOFACTOR_IPA); setLogString("Application Path: " + app.getPath(), true); final DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("device", "iphone"); setHubCapabilities(capabilities); capabilities.setCapability(CapabilityType.BROWSER_NAME, getDeviceName()); capabilities.setCapability("cleanSession", true); capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true); driver = new SwipeableWebDriver(new URL(createHostUrl()), capabilities); } catch (final Exception ex) { checkIfAppiumError(ex); } } return driver; }
From source file:com.ecofactor.qa.automation.platform.util.SeleniumDriverUtil.java
License:Open Source License
/** * Creates the ie driver.//w w w . j a va2 s. c o m * @param browserName the browser name * @param driver the driver * @return the web driver */ private static WebDriver createIfIEDriver(final String browserName, final WebDriver driver) { if (browserName.equals(IE_BROWSER) || browserName.equals(IE_BROWSER8) || browserName.equals(IE_BROWSER9) || browserName.equals(IE_BROWSER10) || browserName.equals(VISTAIE8) || browserName.contains(IE_BROWSER)) { final DesiredCapabilities capability = DesiredCapabilities.internetExplorer(); capability.setCapability(CapabilityType.BROWSER_NAME, I_EXPLORER); return createRemoteDriverForHub(capability); } return driver; }
From source file:com.nowsprinting.hellotesting.appiumtest.appium.AddCustomerTest.java
License:Apache License
@Before public void setUp() throws Exception { AppiumLauncher.launch();//from w w w . j a v a 2 s. c om DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); capabilities.setCapability(MobileCapabilityType.APP_PACKAGE, "com.nowsprinting.hellotesting.appium"); capabilities.setCapability(MobileCapabilityType.APP_ACTIVITY, "com.nowsprinting.hellotesting.app.CustomerListActivity"); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "emulator"); capabilities.setCapability("unicodeKeyboard", true); capabilities.setCapability("resetKeyboard", true); capabilities.setCapability("app", "C:\\AndroidStudioProjects\\AndroidAppsTestAutomationSamples\\app\\build\\outputs\\apk\\app-appium-debug.apk"); mDriver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); mDriver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); }
From source file:com.nowsprinting.hellotesting.appiumtest.selendroid.AddCustomerTest.java
License:Apache License
@Before public void setUp() throws Exception { // ?????desired capabilities????????AndroidDriver?? DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); // Selendroid?????????AUTOMATION_NAME"Selendroid"?? capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Selendroid"); capabilities.setCapability(MobileCapabilityType.APP_PACKAGE, "com.nowsprinting.hellotesting.appium"); capabilities.setCapability(MobileCapabilityType.APP_ACTIVITY, "com.nowsprinting.hellotesting.app.CustomerListActivity"); capabilities.setCapability("unicodeKeyboard", true); capabilities.setCapability("resetKeyboard", true); mDriver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); // ?80??/* w ww. j av a2s . c o m*/ mDriver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); }
From source file:com.partnet.automation.selenium.AbstractConfigurableDriverProvider.java
License:Apache License
/** * Helper method to launch remote web driver. * * At times there are issues with starting the remote web driver. For firefox, * problems with locking port 7054 can arise. * * See the Selenium <a/*from w w w. j av a 2 s . c om*/ * href="https://code.google.com/p/selenium/issues/detail?id=4790">bug</a> for * more info * * A special case needs to be performed for the Android browser, since it can not be cast to {@link RemoteWebDriver} * * @param capabilities web driver capabilities. * @return {@link WebDriver} instance of the remote web driver * */ protected WebDriver initRemoteWebDriver(DesiredCapabilities capabilities) { URL remoteUrl = getRemoteSeleniumUrl(); LOG.debug("Remote Selenium URL: {}", remoteUrl.toString()); WebDriver driver = null; boolean isAndroid = false; int tries = 1; if (capabilities.getCapability(CapabilityType.BROWSER_NAME).equals(ANDROID_BROWSER_NAME)) { isAndroid = true; } while (driver == null) { LOG.debug("Try {} {}", tries, capabilities.toString()); try { if (isAndroid) { driver = new AndroidDriver(remoteUrl, capabilities); } else { driver = new RemoteWebDriver(remoteUrl, capabilities); } } catch (WebDriverException e) { LOG.error("Remote WebDriver was unable to start! " + e.getMessage(), e); if (tries >= Integer.getInteger(REMOTE_WEBDRIVER_RETRY_ATTEMPTS, 10)) { throw e; } sleep(Integer.getInteger(REMOTE_WEBDRIVER_RETRY_PAUSE_MILLIS, 5000) * tries); tries++; driver = null; } } if (!isAndroid) { // allow screenshots to be taken driver = new Augmenter().augment(driver); } // Allow files from the host to be uploaded to a remote browser ((RemoteWebDriver) driver).setFileDetector(new LocalFileDetector()); return driver; }
From source file:com.partnet.automation.selenium.AbstractConfigurableDriverProvider.java
License:Apache License
/** * Configuration to get a handle to the Android driver * @return initialized instance of the {@link AndroidDriver} */// w w w. j a va 2 s. co m private WebDriver getRemoteAndroidWebDriver() { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, ANDROID_BROWSER_NAME); capabilities.setCapability("deviceName", System.getProperty(ANDROID_DEVICE_NAME, "Android")); capabilities.setCapability("platformName", System.getProperty(ANDROID_PLATFORM_NAME, "Android")); capabilities.setCapability("app", System.getProperty(ANDROID_APK_PATH)); if (isSysPropAvailable(ANDROID_PLATFORM_VERSION)) { capabilities.setCapability("platformVersion", System.getProperty(ANDROID_PLATFORM_VERSION, "5.0")); } if (isSysPropAvailable(ANDROID_APP_PKG)) { capabilities.setCapability("appPackage", System.getProperty(ANDROID_APP_PKG)); } if (isSysPropAvailable(ANDROID_APP_WAIT_PKG)) { capabilities.setCapability("appWaitPackage", System.getProperty(ANDROID_APP_WAIT_PKG)); } RemoteWebDriver remoteDriver = (RemoteWebDriver) initRemoteWebDriver(capabilities); AndroidDriver driver = (AndroidDriver) remoteDriver; return driver; }
From source file:com.rmn.qa.AutomationCapabilityMatcherTest.java
License:Open Source License
@Test public void testMatches() { AutomationCapabilityMatcher matcher = new AutomationCapabilityMatcher(); Map<String, Object> nodeCapability = new HashMap<String, Object>(); nodeCapability.put(CapabilityType.BROWSER_NAME, "firefox"); Map<String, Object> testCapability = new HashMap<String, Object>(); testCapability.put(CapabilityType.BROWSER_NAME, "firefox"); Assert.assertTrue("Capabilities should match as node is not dynamic", matcher.matches(nodeCapability, testCapability)); }