APISonar


org.openqa.selenium.remote.BrowserType.ANDROID

> org > openqa > selenium > remote > BrowserType > ANDROID
org APIs openqa APIs selenium APIs remote APIs BrowserType APIs ANDROID APIs

Example 1
public void shouldInitDriverIfNoValidAppIsAvailable() throws Exception {
    SelendroidConfiguration conf = new SelendroidConfiguration();
    SelendroidStandaloneDriver driver = getSelendroidStandaloneDriver(getAndroidApkServerBuilder());

    driver.initApplicationsUnderTest(conf);

    Assert.assertTrue("Expecting only one app to be configured",
        driver.getConfiguredApps().size() == 1);
    Assert.assertEquals("Expecting AndroidDriver app to be configured", driver.getConfiguredApps()
        .get(BrowserType.ANDROID).getAppId(), BrowserType.ANDROID);
  }
Example 2
public static DesiredCapabilities android(DeviceTargetPlatform platform) {
    SelendroidCapabilities capabilities = new SelendroidCapabilities();
    capabilities.setCapability(BROWSER_NAME, BrowserType.ANDROID);
    capabilities.setCapability(VERSION, "");
    capabilities.setCapability(PLATFORM, "android");
    capabilities.setCapability(PLATFORM_NAME, "android");
    capabilities.setCapability(PLATFORM_VERSION, platform.getApi());
    return capabilities;
  }
Example 3
public int score(Capabilities capabilities) {
        int score = 0;

        if (capabilities.getCapability(PLATFORM_NAME) != null) {
            score++;
        }

        String browserName = capabilities.getBrowserName();
        if (browserName.equals(BrowserType.CHROME) || browserName.equals(BrowserType.ANDROID)
                || browserName.equals(BrowserType.SAFARI)) {
            score++;
        }

        return score;
    }
Example 4
protected static SelendroidServerBuilder getAndroidApkServerBuilder() throws IOException,
      ShellCommandException, AndroidSdkException {
    SelendroidServerBuilder builder = mock(SelendroidServerBuilder.class);
    AndroidApp server = mock(AndroidApp.class);
    AndroidApp resignedApp = mock(AndroidApp.class);
    when(resignedApp.getAppId()).thenReturn(BrowserType.ANDROID);

    when(
        builder.createSelendroidServer(new DefaultAndroidApp(new File(
            SelendroidStandaloneDriverTest.APK_FILE)))).thenReturn(server);
    when(builder.resignApp(any(File.class))).thenReturn(resignedApp);
    return builder;
  }