Search in sources :

Example 66 with DesiredCapabilities

use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.

the class BaseSafariTest method beforeClass.

@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.BROWSER_NAME, "Safari");
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST);
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.2");
    // sometimes environment has performance problems
    capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator");
    driver = new IOSDriver<>(service.getUrl(), capabilities);
}
Also used : AppiumServerHasNotBeenStartedLocallyException(io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) BeforeClass(org.junit.BeforeClass)

Example 67 with DesiredCapabilities

use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.

the class AppiumDriver method substituteMobilePlatform.

/**
 * Changes platform name and returns new capabilities.
 *
 * @param originalCapabilities the given {@link Capabilities}.
 * @param newPlatform a {@link MobileCapabilityType#PLATFORM_NAME} value which has
 *                    to be set up
 * @return {@link Capabilities} with changed mobile platform value
 */
protected static Capabilities substituteMobilePlatform(Capabilities originalCapabilities, String newPlatform) {
    DesiredCapabilities dc = new DesiredCapabilities(originalCapabilities);
    dc.setCapability(PLATFORM_NAME, newPlatform);
    return dc;
}
Also used : DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities)

Example 68 with DesiredCapabilities

use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.

the class StartingAppLocallyTest method startingIOSAppWithCapabilitiesAndServiseTest.

@Test
public void startingIOSAppWithCapabilitiesAndServiseTest() {
    File appDir = new File("src/test/java/io/appium/java_client");
    File app = new File(appDir, "UICatalog.app.zip");
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator");
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.APPIUM);
    capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.2");
    // 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();
        assertEquals(true, caps.getCapability(MobileCapabilityType.PLATFORM_NAME).equals(MobilePlatform.IOS));
        assertNotEquals(null, caps.getCapability(MobileCapabilityType.DEVICE_NAME));
    } finally {
        driver.quit();
    }
}
Also used : IOSDriver(io.appium.java_client.ios.IOSDriver) Capabilities(org.openqa.selenium.Capabilities) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) AppiumServiceBuilder(io.appium.java_client.service.local.AppiumServiceBuilder) File(java.io.File) Test(org.junit.Test)

Example 69 with DesiredCapabilities

use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.

the class ServerBuilderTest method checkAbilityToStartServiceUsingCapabilitiesAndFlags.

@Test
public void checkAbilityToStartServiceUsingCapabilitiesAndFlags() {
    File app = ROOT_TEST_PATH.resolve("ApiDemos-debug.apk").toFile();
    File chrome = getChromeDriver();
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability(PLATFORM_NAME, "Android");
    caps.setCapability(FULL_RESET, true);
    caps.setCapability(NEW_COMMAND_TIMEOUT, 60);
    caps.setCapability(APP_PACKAGE, "io.appium.android.apis");
    caps.setCapability(APP_ACTIVITY, ".view.WebView1");
    caps.setCapability(APP, app.getAbsolutePath());
    caps.setCapability(CHROMEDRIVER_EXECUTABLE, chrome.getAbsolutePath());
    service = new AppiumServiceBuilder().withArgument(CALLBACK_ADDRESS, testIP).withArgument(SESSION_OVERRIDE).withArgument(PRE_LAUNCH).withCapabilities(caps).build();
    service.start();
    assertTrue(service.isRunning());
}
Also used : DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) File(java.io.File) Test(org.junit.Test)

Example 70 with DesiredCapabilities

use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.

the class ServerBuilderTest method checkAbilityToStartServiceUsingCapabilities.

@Test
public void checkAbilityToStartServiceUsingCapabilities() {
    File app = ROOT_TEST_PATH.resolve("ApiDemos-debug.apk").toFile();
    File chrome = getChromeDriver();
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability(PLATFORM_NAME, "Android");
    caps.setCapability(FULL_RESET, true);
    caps.setCapability(NEW_COMMAND_TIMEOUT, 60);
    caps.setCapability(APP_PACKAGE, "io.appium.android.apis");
    caps.setCapability(APP_ACTIVITY, ".view.WebView1");
    caps.setCapability(APP, app.getAbsolutePath());
    caps.setCapability(CHROMEDRIVER_EXECUTABLE, chrome.getAbsolutePath());
    service = new AppiumServiceBuilder().withCapabilities(caps).build();
    service.start();
    assertTrue(service.isRunning());
}
Also used : DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) File(java.io.File) Test(org.junit.Test)

Aggregations

DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)173 File (java.io.File)55 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)40 HashMap (java.util.HashMap)33 URL (java.net.URL)32 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)29 ChromeOptions (org.openqa.selenium.chrome.ChromeOptions)28 Test (org.testng.annotations.Test)22 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)20 BeforeClass (org.junit.BeforeClass)19 FirefoxProfile (org.openqa.selenium.firefox.FirefoxProfile)18 TestSetup (com.coveros.selenified.utilities.TestSetup)17 PhantomJSDriver (org.openqa.selenium.phantomjs.PhantomJSDriver)15 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)14 Before (org.junit.Before)13 Test (org.junit.Test)13 MalformedURLException (java.net.MalformedURLException)12 WebDriver (org.openqa.selenium.WebDriver)12 Actions (org.openqa.selenium.interactions.Actions)12 Dimension (org.openqa.selenium.Dimension)11