Search in sources :

Example 86 with DesiredCapabilities

use of org.openqa.selenium.remote.DesiredCapabilities in project android by owncloud.

the class Common method setUpCommonDriver.

protected AndroidDriver setUpCommonDriver() throws Exception {
    File rootPath = new File(System.getProperty("user.dir"));
    File appDir = new File(rootPath, "src/test/resources");
    File app = new File(appDir, "ownCloud.apk");
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability("deviceName", "test");
    capabilities.setCapability("app", app.getAbsolutePath());
    capabilities.setCapability("appPackage", "com.owncloud.android");
    capabilities.setCapability("appActivity", ".ui.activity.FileDisplayActivity");
    capabilities.setCapability("appWaitActivity", ".authentication.AuthenticatorActivity");
    driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(waitingTime, TimeUnit.SECONDS);
    wait = new WebDriverWait(driver, waitingTime, 50);
    return driver;
}
Also used : DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) AndroidDriver(io.appium.java_client.android.AndroidDriver) File(java.io.File) URL(java.net.URL)

Example 87 with DesiredCapabilities

use of org.openqa.selenium.remote.DesiredCapabilities in project Asqatasun by Asqatasun.

the class PhantomJsFactory method make.

/**
     * 
     * @param config
     * @return A FirefoxDriver.
     */
@Override
public RemoteWebDriver make(HashMap<String, String> config) {
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setJavascriptEnabled(true);
    if (System.getProperty(PHANTOMJS_PATH_PROPERTY) != null) {
        path = System.getProperty(PHANTOMJS_PATH_PROPERTY);
    }
    caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, path);
    return new PhantomJSDriver(caps);
}
Also used : PhantomJSDriver(org.openqa.selenium.phantomjs.PhantomJSDriver) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities)

Example 88 with DesiredCapabilities

use of org.openqa.selenium.remote.DesiredCapabilities in project geode by apache.

the class WebDriverRule method setUpWebDriver.

private void setUpWebDriver() {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setJavascriptEnabled(true);
    capabilities.setCapability("takesScreenshot", true);
    capabilities.setCapability("phantomjs.page.settings.userAgent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:16.0) Gecko/20121026 Firefox/16.0");
    driver = new PhantomJSDriver(capabilities);
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    driver.manage().timeouts().pageLoadTimeout(300, TimeUnit.SECONDS);
}
Also used : PhantomJSDriver(org.openqa.selenium.phantomjs.PhantomJSDriver) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities)

Example 89 with DesiredCapabilities

use of org.openqa.selenium.remote.DesiredCapabilities in project fess by codelibs.

the class WebDriverGenerator method startWebDriver.

protected void startWebDriver() {
    try {
        if (webDriver == null) {
            if (webDriverCapabilities == null) {
                webDriver = new PhantomJSDriver();
            } else {
                if (webDriverCapabilities instanceof DesiredCapabilities) {
                    final DesiredCapabilities capabilities = (DesiredCapabilities) webDriverCapabilities;
                    webDriverCapabilities.asMap().entrySet().stream().filter(e -> e.getValue() instanceof String && filePathMap.containsKey(e.getValue().toString())).forEach(e -> capabilities.setCapability(e.getKey(), filePathMap.get(e.getValue().toString())));
                }
                webDriver = new PhantomJSDriver(createDriverService(webDriverCapabilities), webDriverCapabilities);
            }
        }
        final FessConfig fessConfig = ComponentUtil.getFessConfig();
        webDriver.manage().window().setSize(new Dimension(fessConfig.getThumbnailHtmlPhantomjsWindowWidthAsInteger(), fessConfig.getThumbnailHtmlPhantomjsWindowHeightAsInteger()));
        previousCheckTime = ComponentUtil.getSystemHelper().getCurrentTimeAsLong();
    } catch (final Exception e) {
        if (logger.isDebugEnabled()) {
            logger.debug("WebDriver is not available for generating thumbnails.", e);
        } else {
            logger.info("WebDriver is not available for generating thumbnails.");
        }
    }
}
Also used : Rectangle(java.awt.Rectangle) OutputType(org.openqa.selenium.OutputType) UnreachableBrowserException(org.openqa.selenium.remote.UnreachableBrowserException) WebDriver(org.openqa.selenium.WebDriver) Proxy(org.openqa.selenium.Proxy) LoggerFactory(org.slf4j.LoggerFactory) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) TakesScreenshot(org.openqa.selenium.TakesScreenshot) ImageIO(javax.imageio.ImageIO) Dimension(org.openqa.selenium.Dimension) PhantomJSDriver(org.openqa.selenium.phantomjs.PhantomJSDriver) ImageReader(javax.imageio.ImageReader) Proxies(org.openqa.selenium.browserlaunchers.Proxies) CommandLine(org.openqa.selenium.os.CommandLine) Builder(org.openqa.selenium.phantomjs.PhantomJSDriverService.Builder) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) BufferedImage(java.awt.image.BufferedImage) Collection(java.util.Collection) By(org.openqa.selenium.By) IOException(java.io.IOException) Capabilities(org.openqa.selenium.Capabilities) FileInputStream(java.io.FileInputStream) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) File(java.io.File) ImageInputStream(javax.imageio.stream.ImageInputStream) ImageReadParam(javax.imageio.ImageReadParam) ComponentUtil(org.codelibs.fess.util.ComponentUtil) SessionNotFoundException(org.openqa.selenium.remote.SessionNotFoundException) PostConstruct(javax.annotation.PostConstruct) PhantomJSDriverService(org.openqa.selenium.phantomjs.PhantomJSDriverService) PhantomJSDriver(org.openqa.selenium.phantomjs.PhantomJSDriver) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) Dimension(org.openqa.selenium.Dimension) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) UnreachableBrowserException(org.openqa.selenium.remote.UnreachableBrowserException) IOException(java.io.IOException) SessionNotFoundException(org.openqa.selenium.remote.SessionNotFoundException)

Example 90 with DesiredCapabilities

use of org.openqa.selenium.remote.DesiredCapabilities in project charts by vaadin.

the class ChartsBrowserFactory method createIE.

private DesiredCapabilities createIE(Browser browser, String version) {
    DesiredCapabilities capabilities = create(browser, version, Platform.WINDOWS);
    capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
    return capabilities;
}
Also used : DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities)

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