Java Code Examples for org.openqa.selenium.remote.DesiredCapabilities

The following examples show how to use org.openqa.selenium.remote.DesiredCapabilities. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: java-client   Source File: BaseEspressoTest.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * initialization.
 */
@BeforeClass public static void beforeClass() {
    service = AppiumDriverLocalService.buildDefaultService();
    service.start();

    if (service == null || !service.isRunning()) {
        throw new AppiumServerHasNotBeenStartedLocallyException(
            "An appium server node is not started!");
    }

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ESPRESSO);
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
    capabilities.setCapability(MobileCapabilityType.APP, apiDemosApk().toAbsolutePath().toString());
    capabilities.setCapability("eventTimings", true);
    driver = new AndroidDriver<>(service.getUrl(), capabilities);
}
 
Example 2
@Before
public void setUp() throws Exception {
    // set up appium
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.BROWSER_NAME, "Selendroid");

    capabilities.setCapability(CapabilityType.VERSION, "4.2.2");

    capabilities.setCapability("device", "Android");
    capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
    capabilities.setCapability("app", "https://s3.amazonaws.com/voodoo2/SugarCRM.apk.zip");
    capabilities.setCapability("app-package", "com.sugarcrm.nomad");
    capabilities.setCapability("app-activity", "NomadActivity");

    driver = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    values = new ArrayList<>();
}
 
Example 3
Source Project: samples   Source File: WebTestAndroid.java    License: MIT License 6 votes vote down vote up
@BeforeTest
@Override
public void Setup() throws Exception {
    super.Setup();

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("sessionName", "Android Web Test");
    capabilities.setCapability("sessionDescription", "Kobiton sample session");
    capabilities.setCapability("deviceOrientation", "portrait");
    capabilities.setCapability("captureScreenshots", true);
    capabilities.setCapability("browserName", "chrome");
    capabilities.setCapability("deviceName", "Galaxy S6");
    capabilities.setCapability("platformName", "Android");

    driver = new RemoteWebDriver(getAutomationUrl(), capabilities);
}
 
Example 4
@BeforeTest
public void setUp() throws Exception {

    // Set the desired capabilities for Android Device
    DesiredCapabilities caps = DesiredCapabilities.android();
    caps.setCapability("deviceOrientation", "portrait");
    caps.setCapability("platformVersion", "8.1");
    caps.setCapability("platformName", "Android");
    caps.setCapability("browserName", "Chrome");

    // Create an instance of AndroidDriver for testing on Android platform
    // connect to the local Appium server running on a different machine
    // We will use WebElement type for testing the Web application
    driver = new AndroidDriver<WebElement>(new URL(
            "http://192.168.0.101:4723/wd/hub"), caps);
    driver.get("http://demo-store.seleniumacademy.com/");
}
 
Example 5
Source Project: vividus   Source File: WebDriverTypeTests.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private static DesiredCapabilities testGetFirefoxWebDriver(WebDriverConfiguration configuration) throws Exception
{
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    FirefoxOptions firefoxOptions = new FirefoxOptions();
    whenNew(FirefoxOptions.class).withArguments(desiredCapabilities).thenReturn(firefoxOptions);
    whenNew(FirefoxOptions.class).withNoArguments().thenReturn(firefoxOptions);
    FirefoxDriver expected = mock(FirefoxDriver.class);
    whenNew(FirefoxDriver.class).withParameterTypes(FirefoxOptions.class).withArguments(firefoxOptions)
            .thenReturn(expected);
    WebDriver actual = WebDriverType.FIREFOX.getWebDriver(desiredCapabilities, configuration);
    assertEquals(expected, actual);
    Map<String, Object> options = (Map<String, Object>) desiredCapabilities
            .getCapability(FirefoxOptions.FIREFOX_OPTIONS);
    Map<String, Object> prefs = (Map<String, Object>) options.get("prefs");
    assertEquals("about:blank", prefs.get("startup.homepage_welcome_url.additional"));
    return desiredCapabilities;
}
 
Example 6
Source Project: samples   Source File: AppTestIOS.java    License: MIT License 6 votes vote down vote up
@BeforeTest
@Override
public void Setup() throws Exception {
    super.Setup();

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("sessionName", "iOS App Test");
    capabilities.setCapability("sessionDescription", "Kobiton sample session");
    capabilities.setCapability("deviceOrientation", "portrait");
    capabilities.setCapability("captureScreenshots", true);
    capabilities.setCapability("app", "https://s3-ap-southeast-1.amazonaws.com/kobiton-devvn/apps-test/demo/iFixit.ipa");
    capabilities.setCapability("deviceName", "iPhone 6s");
    capabilities.setCapability("platformName", "iOS");

    driver = new IOSDriver<>(getAutomationUrl(), capabilities);
    driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
 
Example 7
Source Project: java-client   Source File: StartingAppLocallyTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test public void startingIOSAppWithCapabilitiesAndServiceTest() {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, BaseIOSTest.DEVICE_NAME);
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.APPIUM);
    capabilities.setCapability(MobileCapabilityType.APP, uiCatalogAppZip().toAbsolutePath().toString());
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, BaseIOSTest.PLATFORM_VERSION);
    //sometimes environment has performance problems
    capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);

    AppiumServiceBuilder builder = new AppiumServiceBuilder()
            .withArgument(GeneralServerFlag.SESSION_OVERRIDE)
            .withArgument(GeneralServerFlag.STRICT_CAPS);

    IOSDriver<?> driver = new IOSDriver<>(builder, capabilities);
    try {
        Capabilities caps = driver.getCapabilities();
        assertTrue(caps.getCapability(MobileCapabilityType.PLATFORM_NAME)
                .toString().equalsIgnoreCase(MobilePlatform.IOS));
        assertNotNull(null, caps.getCapability(MobileCapabilityType.DEVICE_NAME));
    } finally {
        driver.quit();
    }
}
 
Example 8
Source Project: coteafs-selenium   Source File: Browser.java    License: Apache License 2.0 6 votes vote down vote up
private static WebDriver setupRemote() {
    LOG.i("Setting up Remote driver...");
    final RemoteSetting remoteSetting = appSetting().getRemote();
    final RemoteSource source = remoteSetting.getSource();
    final DesiredCapabilities caps = new DesiredCapabilities();
    switch (source) {
        case SAUCELABS:
            setupCloud(remoteSetting, caps, "sauce");
            break;
        case BROWSERSTACK:
            setupCloud(remoteSetting, caps, "bstack");
            break;
        case GRID:
        default:
            setupCloud(remoteSetting, caps, null);
            break;
    }
    return createRemoteSession(remoteSetting, caps);
}
 
Example 9
@Before
public void setUp() throws Exception {
    // set up appium
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
    capabilities.setCapability(CapabilityType.VERSION, "4.2.2");

    capabilities.setCapability("device", "Android");
    capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
    capabilities.setCapability("app", "https://s3.amazonaws.com/voodoo2/TestApp.apk.zip");
    capabilities.setCapability("app-package", "com.example.TestApp");
    capabilities.setCapability("app-activity", "MyActivity");

    driver = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    values = new ArrayList<>();
}
 
Example 10
Source Project: test-samples   Source File: BaseTest.java    License: Apache License 2.0 6 votes vote down vote up
private void setupRemoteDriver(String device, String xmlTestName) throws MalformedURLException {
    loadProperties(device);

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("bitbar_apiKey", "<YOUR_BITBAR_API_KEY>");
    capabilities.setCapability("bitbar_testrun", this.getClass().getSimpleName());
    capabilities.setCapability("bitbar_project", xmlTestName);
    capabilities.setCapability("bitbar_device", bitbarDevice);
    capabilities.setCapability("browserName", browserName);
    capabilities.setCapability("platformName", platformName);
    capabilities.setCapability("deviceName", deviceName);
    if (automationName != null)
        capabilities.setCapability("automationName", automationName);

    driver.set(new RemoteWebDriver(new URL("https://appium.bitbar.com/wd/hub/"), capabilities));
}
 
Example 11
Source Project: selenium   Source File: UtilsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void providesRemoteAccessToWebStorage() {
  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(CapabilityType.SUPPORTS_WEB_STORAGE, true);

  CapableDriver driver = mock(CapableDriver.class);
  when(driver.getCapabilities()).thenReturn(caps);

  WebStorage storage = Utils.getWebStorage(driver);

  LocalStorage localStorage = storage.getLocalStorage();
  SessionStorage sessionStorage = storage.getSessionStorage();

  localStorage.setItem("foo", "bar");
  sessionStorage.setItem("bim", "baz");

  verify(driver).execute(DriverCommand.SET_LOCAL_STORAGE_ITEM, ImmutableMap.of(
      "key", "foo", "value", "bar"));
  verify(driver).execute(DriverCommand.SET_SESSION_STORAGE_ITEM, ImmutableMap.of(
      "key", "bim", "value", "baz"));
}
 
Example 12
Source Project: appiumpro   Source File: Edition003_Arbitrary_ADB.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testArbitraryADBCommands() throws MalformedURLException {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability("deviceName", "Android Emulator");
    capabilities.setCapability("automationName", "UiAutomator2");
    capabilities.setCapability("appPackage", "com.google.android.apps.photos");
    capabilities.setCapability("appActivity", ".home.HomeActivity");

    // Open the app.
    AndroidDriver driver = new AndroidDriver<>(new URL("http://localhost:4723/wd/hub"), capabilities);

    try {
        List<String> removePicsArgs = Arrays.asList("-rf", ANDROID_PHOTO_PATH + "/*.*");
        Map<String, Object> removePicsCmd = ImmutableMap
            .of("command", "rm", "args", removePicsArgs);
        driver.executeScript("mobile: shell", removePicsCmd);

        List<String> lsArgs = Arrays.asList("/mnt/sdcard");
        Map<String, Object> lsCmd = ImmutableMap.of("command", "ls", "args", lsArgs);
        String lsOutput = (String) driver.executeScript("mobile: shell", lsCmd);
        Assert.assertEquals("", lsOutput);
    } finally {
        driver.quit();
    }
}
 
Example 13
public static DesiredCapabilities build(RemoteCapability capability){
 DesiredCapabilities desiredCapabilities;
 if(RemoteCapability.CHROME.equals(capability)){
  ChromeOptions options = new ChromeOptions();
     desiredCapabilities = DesiredCapabilities.chrome();
     desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options);
  return desiredCapabilities;
 } else if (RemoteCapability.FIREFOX.equals(capability)){
  FirefoxProfile profile = new FirefoxProfile();
  desiredCapabilities = DesiredCapabilities.firefox();
  desiredCapabilities.setCapability(FirefoxDriver.PROFILE, profile);
  return desiredCapabilities;
 } else if (RemoteCapability.INTERNET_EXPLORER.equals(capability)){
  desiredCapabilities = DesiredCapabilities.internetExplorer();
  return desiredCapabilities;
 } else if (RemoteCapability.PHANTOMJS.equals(capability)){
  desiredCapabilities = DesiredCapabilities.phantomjs();
  return desiredCapabilities;
 }
 throw new IllegalArgumentException("No such capability");
}
 
Example 14
Source Project: appiumpro   Source File: Edition036_NativeWebTap.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testClickLink_iOS_withoutNativeWebTap() throws MalformedURLException {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("platformName", "iOS");
    capabilities.setCapability("platformVersion", "11.4");
    capabilities.setCapability("deviceName", "iPhone 8");
    capabilities.setCapability("browserName", "Safari");

    IOSDriver driver = new IOSDriver<>(new URL("http://localhost:4723/wd/hub"), capabilities);
    actualTest(driver);
}
 
Example 15
Source Project: webtester-core   Source File: InternetExplorerFactory.java    License: Apache License 2.0 5 votes vote down vote up
public InternetExplorerFactory() {
    super(new Function<DesiredCapabilities, WebDriver>() {
        @Override
        public WebDriver apply(DesiredCapabilities capabilities) {
            return new InternetExplorerDriver(capabilities);
        }
    });
}
 
Example 16
Source Project: webtester2-core   Source File: RemoteFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Browser createBrowser() {
    String browserName = configuration.getRemoteBrowserName();
    String browserVersion = configuration.getRemoteBrowserVersion();
    DesiredCapabilities capabilities = new DesiredCapabilities(browserName, browserVersion, Platform.ANY);
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    capabilities.setCapability(CapabilityType.HAS_NATIVE_EVENTS, false);
    capabilities.setCapability("marionette", configuration.getRemoteFirefoxMarionette());
    setOptionalProxyConfiguration(capabilities);
    return createBrowser(capabilities);
}
 
Example 17
Source Project: selenium-grid-extensions   Source File: AbstractTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
    readGridHostPort();

    DesiredCapabilities desiredCapabilities = firefoxWithSikuli();
    URL url = new URL(String.format("http://%s:%d/wd/hub", host, port));

    RemoteWebDriver remoteWebDriver = new RemoteWebDriver(url, desiredCapabilities);
    WebDriverRunner.setWebDriver(remoteWebDriver);
}
 
Example 18
public static WebDriver getEdgeDriver()
{
	String path = System.getProperty("user.dir") + "\\Drivers\\EdgeWebDriver.exe";
	System.setProperty("webdriver.ie.driver", path);
	DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
	caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,	true);
	return new InternetExplorerDriver(caps);
}
 
Example 19
public DeviceWebDriver( String xmlData, Device currentDevice, DesiredCapabilities dC )
{
    this.cachingEnabled = true;
    readXML( xmlData );
    this.currentDevice = currentDevice;
    this.syntheticConnection = true;
    this.dC = dC;
}
 
Example 20
Source Project: phoenix.webui.framework   Source File: CapabilityConfig.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 火狐浏览器配置
 */
private void firefox()
{
	DesiredCapabilities capability = DesiredCapabilities.firefox();
	capability.setCapability("marionette", true);
	engineCapMap.put(DRIVER_FIREFOX, capability);
}
 
Example 21
Source Project: akita   Source File: CustomDriverProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public WebDriver createDriver(DesiredCapabilities capabilities) {
    Configuration.browserSize = String.format("%sx%s", loadSystemPropertyOrDefault(WINDOW_WIDTH, DEFAULT_WIDTH),
            loadSystemPropertyOrDefault(WINDOW_HEIGHT, DEFAULT_HEIGHT));
    String expectedBrowser = loadSystemPropertyOrDefault(BROWSER, CHROME);
    String remoteUrl = loadSystemPropertyOrDefault(REMOTE_URL, LOCAL);
    BlackList blackList = new BlackList();
    boolean isProxyMode = loadSystemPropertyOrDefault(PROXY, false);
    if (isProxyMode) {
        enableProxy(capabilities);
    }

    log.info("remoteUrl=" + remoteUrl + " expectedBrowser= " + expectedBrowser + " BROWSER_VERSION=" + System.getProperty(CapabilityType.BROWSER_VERSION));

    switch (expectedBrowser.toLowerCase()) {
        case (FIREFOX):
            return LOCAL.equalsIgnoreCase(remoteUrl) ? createFirefoxDriver(capabilities) : getRemoteDriver(getFirefoxDriverOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());
        case (MOBILE_DRIVER):
            return LOCAL.equalsIgnoreCase(remoteUrl) ? new ChromeDriver(getMobileChromeOptions(capabilities)) : getRemoteDriver(getMobileChromeOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());
        case (OPERA):
            return LOCAL.equalsIgnoreCase(remoteUrl) ? createOperaDriver(capabilities) : getRemoteDriver(getOperaRemoteDriverOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());
        case (SAFARI):
            return LOCAL.equalsIgnoreCase(remoteUrl) ? createSafariDriver(capabilities) : getRemoteDriver(getSafariDriverOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());
        case (INTERNET_EXPLORER):
            return LOCAL.equalsIgnoreCase(remoteUrl) ? createIEDriver(capabilities) : getRemoteDriver(getIEDriverOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());
        case (IE):
            return LOCAL.equalsIgnoreCase(remoteUrl) ? createIEDriver(capabilities) : getRemoteDriver(getIEDriverOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());
        case (EDGE):
            return LOCAL.equalsIgnoreCase(remoteUrl) ? createEdgeDriver(capabilities) : getRemoteDriver(getEdgeDriverOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());
        default:
            return LOCAL.equalsIgnoreCase(remoteUrl) ? createChromeDriver(capabilities) : getRemoteDriver(getChromeDriverOptions(capabilities), remoteUrl, blackList.getBlacklistEntries());

    }
}
 
Example 22
Source Project: Quantum   Source File: UiDriverFactory.java    License: MIT License 5 votes vote down vote up
private Browsers(DesiredCapabilities desiredCapabilities, Class<? extends WebDriver> driver) {
	this(desiredCapabilities);
	if (null == getDriverCls()) {
		// not overridden by extra capability
		setDriverCls(driver);
	}
}
 
Example 23
Source Project: Quantum   Source File: UiDriverFactory.java    License: MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
private Browsers(DesiredCapabilities desiredCapabilities, String drivercls) {
	this(desiredCapabilities);
	if (null == getDriverCls()) {
		// not overridden by extra capability
		try {
			setDriverCls((Class<? extends WebDriver>) Class.forName(drivercls));
		} catch (Exception e) {
			// throw new AutomationError(e);
		}
	}

}
 
Example 24
Source Project: java-client   Source File: IOSElementGenerationTest.java    License: Apache License 2.0 5 votes vote down vote up
private boolean check(Supplier<Capabilities> capabilitiesSupplier,
                      BiPredicate<By, Class<? extends WebElement>> filter,
                      By by) {
    service = AppiumDriverLocalService.buildDefaultService();
    Capabilities caps = capabilitiesSupplier.get();
    DesiredCapabilities fixedCaps = new DesiredCapabilities(caps);
    fixedCaps.setCapability("commandTimeouts", "120000");
    try {
        driver = new AppiumDriver<>(service, fixedCaps);
    } catch (SessionNotCreatedException e) {
        fixedCaps.setCapability("useNewWDA", true);
        driver = new AppiumDriver<>(service, fixedCaps);
    }
    return filter.test(by, IOSElement.class);
}
 
Example 25
Source Project: vividus   Source File: WebDriverTypeTests.java    License: Apache License 2.0 5 votes vote down vote up
private static void testGetChromeWebDriver(WebDriverConfiguration configuration, ChromeOptions chromeOptions)
        throws Exception
{
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    ChromeDriver expected = mock(ChromeDriver.class);
    whenNew(ChromeDriver.class).withParameterTypes(ChromeOptions.class).withArguments(chromeOptions)
            .thenReturn(expected);
    WebDriver actual = WebDriverType.CHROME.getWebDriver(desiredCapabilities, configuration);
    assertEquals(expected, actual);
}
 
Example 26
Source Project: vividus   Source File: WebDriverTypeTests.java    License: Apache License 2.0 5 votes vote down vote up
@Test
@PrepareForTest(fullyQualifiedNames = "org.vividus.selenium.WebDriverType$1")
public void testGetFirefoxWebDriverWithCommandLineArguments() throws Exception
{
    String argument = "headless";
    WebDriverConfiguration configuration = new WebDriverConfiguration();
    DesiredCapabilities desiredCapabilities = testGetFirefoxWebDriver(configuration);
    FirefoxOptions expected = new FirefoxOptions();
    expected.addArguments(argument);
    assertEquals(expected.asMap(), desiredCapabilities.asMap());
}
 
Example 27
Source Project: java-client   Source File: AndroidElementGeneratingTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void whenAndroidHybridAppIsLaunched() {
    assertTrue(check(() -> {
        DesiredCapabilities clientCapabilities = commonCapabilitiesSupplier.get();
        clientCapabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "io.appium.android.apis");
        clientCapabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ".view.WebView1");
        return clientCapabilities;
    }, (by, aClass) -> {
        driver.context("WEBVIEW_io.appium.android.apis");
        return commonPredicate.test(by, aClass);
    }, tagName("a")));
}
 
Example 28
Source Project: webtester-core   Source File: BaseBrowserFactory.java    License: Apache License 2.0 5 votes vote down vote up
protected DesiredCapabilities getDefaultCapabilities() {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.HAS_NATIVE_EVENTS, false);
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    setOptionalProxyConfiguration(capabilities);
    return capabilities;
}
 
Example 29
Source Project: selenium   Source File: JsonTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void shouldProperlyFillInACapabilitiesObject() {
  DesiredCapabilities capabilities =
      new DesiredCapabilities("browser", CapabilityType.VERSION, Platform.ANY);
  capabilities.setJavascriptEnabled(true);
  String text = new Json().toJson(capabilities);

  Capabilities readCapabilities = new Json().toType(text, DesiredCapabilities.class);

  assertThat(readCapabilities).isEqualTo(capabilities);
}
 
Example 30
Source Project: SWET   Source File: BrowserDriver.java    License: MIT License 5 votes vote down vote up
private static DesiredCapabilities capabilitiesAndroid() {
	DesiredCapabilities capabilities = DesiredCapabilities.chrome();

	Map<String, String> mobileEmulation = new HashMap<>();
	mobileEmulation.put("deviceName", "Google Nexus 5");

	Map<String, Object> chromeOptions = new HashMap<>();
	chromeOptions.put("mobileEmulation", mobileEmulation);
	capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);

	return capabilities;
}