Example usage for org.openqa.selenium WebDriver manage

List of usage examples for org.openqa.selenium WebDriver manage

Introduction

In this page you can find the example usage for org.openqa.selenium WebDriver manage.

Prototype

Options manage();

Source Link

Document

Gets the Option interface

Usage

From source file:com.cognifide.qa.bb.provider.selenium.webdriver.modifiers.webdriver.ImplicitTimeoutModifier.java

License:Apache License

@Override
public WebDriver modify(WebDriver webDriver) {
    webDriver.manage().timeouts().implicitlyWait(defaultTimeout, TimeUnit.SECONDS);
    return webDriver;
}

From source file:com.cognifide.qa.bb.provider.selenium.webdriver.modifiers.webdriver.MaximizeModifier.java

License:Apache License

@Override
public WebDriver modify(WebDriver webDriver) {
    webDriver.manage().window().maximize();
    return webDriver;
}

From source file:com.cognifide.qa.bb.provider.selenium.webdriver.WebDriverType.java

License:Apache License

private static WebDriver getWebDriverWithProxyCookieSupport(Properties properties, WebDriver driver) {
    if (Boolean.valueOf(properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE))) {
        driver.get(properties.getProperty(ConfigKeys.BASE_URL));
        Cookie cookie = new Cookie(properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE_NAME),
                properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE_VALUE),
                "." + properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE_DOMAIN), "/",
                DateUtils.addMonths(new Date(), 1));
        driver.manage().addCookie(cookie);
    }//  w ww.  j  a v  a 2s  . c  o m
    return driver;
}

From source file:com.comcast.cookie.handlers.GeneralCookieHandler.java

License:Apache License

/**
 * {@inheritDoc}/*from  w w  w.  ja  va 2  s .  c o  m*/
 */
@Override
public boolean clearAllCookies(WebDriver wd) {
    if (null != wd) {
        wd.manage().deleteAllCookies();
    }
    return true;
}

From source file:com.comcast.cookie.handlers.GeneralCookieHandlerTest.java

License:Apache License

@Test(groups = { "cookie" })
public void testCookieMockDriver() {
    CookieHandler ch = new GeneralCookieHandler();

    WebDriver wd = mock(WebDriver.class);
    Options o = mock(Options.class);

    when(wd.manage()).thenReturn(o);
    Assert.assertTrue(ch.clearAllCookies(wd));

    verify(wd).manage();//from  w  ww  . j av a 2  s  .com
    verify(o).deleteAllCookies();
}

From source file:com.comcast.magicwand.drivers.AbstractPhoenixDriver.java

License:Apache License

/**
 * {@inheritDoc}/*from  w ww  . ja  v  a  2 s  .  c  o  m*/
 */
public Options manage() {
    WebDriver driver = this.getDriver();
    Options manage = null;

    if (null != driver) {
        manage = driver.manage();
    }

    return manage;
}

From source file:com.demo.selenium.example.GridExampleTest.java

License:Apache License

@Test
public void GridTwoNodeTest() throws MalformedURLException, InterruptedException {

    DesiredCapabilities aDesiredcap = DesiredCapabilities.chrome();
    WebDriver dr = new RemoteWebDriver(new URL("http://172.19.6.46:5555/wd/hub"), aDesiredcap);
    dr.get("http://www.baidu.com");
    dr.manage().window().maximize();

    String str[] = new String[] { "java", "selenium", "spring", "mybatis", "jps", "grid", "mysql", "iphone" };
    for (String string : str) {
        WebElement element = dr.findElement(By.xpath(".//*[@id='kw']"));
        element.clear();/*from w ww .j ava2  s  . c  o m*/
        element.sendKeys(string);

        Thread.sleep(1000);

        WebElement buttons = dr.findElement(By.xpath(".//*[@id='su']"));

        System.out.println(buttons.getTagName());

        buttons.click();
    }

    Thread.sleep(2000);

    dr.close();

}

From source file:com.dhenton9000.screenshots.ScreenShotLauncher.java

/**
 * set up the webdriver/*from w  w  w .  ja v  a  2  s .c o m*/
 *
 * @return
 */
private WebDriver configureDriver() {

    WebDriver driver = null;
    LoggingPreferences logs = new LoggingPreferences();
    logs.enable(LogType.BROWSER, Level.SEVERE);
    logs.enable(LogType.CLIENT, Level.SEVERE);
    logs.enable(LogType.DRIVER, Level.SEVERE);
    logs.enable(LogType.PERFORMANCE, Level.SEVERE);
    logs.enable(LogType.PROFILER, Level.SEVERE);
    logs.enable(LogType.SERVER, Level.SEVERE);

    DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
    desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, logs);
    LOG.debug("creating firefox driver");
    driver = new FirefoxDriver(desiredCapabilities);
    LOG.debug("got firefox driver");

    driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
    LOG.debug("driver is loaded via config " + driver.toString());

    return driver;
}

From source file:com.ecofactor.qa.automation.newapp.InfrastructureTest.java

License:Open Source License

/**
 * Creates the driver./* w  w w .j a va  2s  .c  o  m*/
 * @return the web driver
 */
@SuppressWarnings("unused")
private WebDriver createDriver() {

    LogUtil.setLogString("Create New webdriver", true);
    LogUtil.setLogString("Browser : " + System.getProperty("browser"), true);
    final WebDriver driver = SeleniumDriverUtil.createBrowserDriver(System.getProperty("browser"));
    driver.manage().window().maximize();
    final String url = mobileConfig.get(ECOFACTOR_URL);
    LogUtil.setLogString("Load Url: " + url, true);
    driver.navigate().to(url);
    smallWait();
    return driver;
}

From source file:com.ecofactor.qa.automation.newapp.MenuTest.java

License:Open Source License

/**
 * Creates the driver.//from w  w  w .  j av  a 2 s .com
 * @return the web driver
 */
@SuppressWarnings("unused")
private WebDriver createWebDriver() {

    LogUtil.setLogString("Create New webdriver", true);
    LogUtil.setLogString("Browser : " + System.getProperty("browser"), true);
    final WebDriver driver = SeleniumDriverUtil.createBrowserDriver(System.getProperty("browser"));
    driver.manage().window().maximize();
    final String url = mobileConfig.get(MobileConfig.ECOFACTOR_URL);
    LogUtil.setLogString("Load Url: " + url, true);
    driver.navigate().to(url);
    WaitUtil.smallWait();
    return driver;
}