Example usage for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver

List of usage examples for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver

Introduction

In this page you can find the example usage for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver.

Prototype

public FirefoxDriver() 

Source Link

Usage

From source file:cn.hxh.springside.test.functional.WebDriverFactory.java

License:Apache License

/**
 * ?driverName??WebDriver.//from ww  w .ja v a  2  s.  c  om
 * 
 * ????Windows, IE?XWindows, ?remote dirverWindows.
 * drivernameremote:192.168.0.2:3000:firefox, ??http://192.168.0.2:3000/wd?selnium remote?.
 * @throws MalformedURLException 
 */
public static WebDriver createDriver(String driverName) {
    WebDriver driver = null;

    if (BrowserType.firefox.name().equals(driverName)) {
        driver = new FirefoxDriver();
    } else if (BrowserType.ie.name().equals(driverName)) {
        driver = new InternetExplorerDriver();
    } else if (driverName.startsWith(BrowserType.remote.name())) {
        String[] params = driverName.split(":");
        Assert.isTrue(params.length == 4,
                "Remote driver is not right, accept format is \"remote:localhost:3000:firefox\", but the input is\""
                        + driverName + "\"");

        String remoteHost = params[1];
        String remotePort = params[2];
        String driverType = params[3];
        DesiredCapabilities cap = null;

        if (BrowserType.firefox.name().equals(driverType)) {
            cap = DesiredCapabilities.firefox();
        } else if (BrowserType.ie.name().equals(driverType)) {
            cap = DesiredCapabilities.internetExplorer();
        }

        try {
            driver = new RemoteWebDriver(new URL("http://" + remoteHost + ":" + remotePort + "/wd"), cap);
        } catch (MalformedURLException e) {
            throw ExceptionUtils.unchecked(e);
        }
    }

    Assert.notNull(driver, "Driver could be found by name:" + driverName);

    return driver;
}

From source file:cn.newtouch.util.test.utils.SeleniumUtils.java

License:Apache License

/**
 * ?driverName??WebDriver./*from  www . j  a va  2  s  .  c  o  m*/
 * 
 * ????Windows, IE?XWindows, ?remote dirverWindows.
 * drivernameremote:192.168.0.2:3000:firefox, ??http://192.168.0.2:3000/wd?selnium remote?.
 */
public static WebDriver buildDriver(String driverName) throws Exception {
    WebDriver driver = null;

    if (HTMLUNIT.equals(driverName)) {
        driver = new HtmlUnitDriver();
        ((HtmlUnitDriver) driver).setJavascriptEnabled(true);
    }

    if (FIREFOX.equals(driverName)) {
        driver = new FirefoxDriver();
    }

    if (IE.equals(driverName)) {
        driver = new InternetExplorerDriver();
    }

    if (driverName.startsWith(REMOTE)) {
        String[] params = driverName.split(":");
        Assert.isTrue(params.length == 4,
                "Remote driver is not right, accept format is \"remote:localhost:3000:firefox\", but the input is\""
                        + driverName + "\"");

        String remoteHost = params[1];
        String remotePort = params[2];
        String driverType = params[3];
        DesiredCapabilities cap = null;
        if (FIREFOX.equals(driverType)) {
            cap = DesiredCapabilities.firefox();
        }

        if (IE.equals(driverType)) {
            cap = DesiredCapabilities.internetExplorer();
        }

        driver = new RemoteWebDriver(new URL("http://" + remoteHost + ":" + remotePort + "/wd"), cap);
    }

    Assert.notNull(driver, "No driver could be found by name:" + driverName);

    return driver;
}

From source file:co.edu.uniandes.Callys.web.test.CallysTest.java

@BeforeClass
public static void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://localhost:8080";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:co.edu.uniandes.csw.appmarketplace.functionalTest.AppFunctionalIT.java

@BeforeClass
public static void setUp() {
    // Crea una instancia del driver de firefox sobre el que se ejecutara la aplicacion.
    driver = new FirefoxDriver();
}

From source file:co.edu.uniandes.csw.cliente.web.test.ClienteTest.java

@BeforeClass
public static void setUp() throws Exception {
    driver = new FirefoxDriver();
    // se define el url base del proyecto web
    baseUrl = "http://localhost:8080";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:co.edu.uniandes.csw.ClinicaDeProblemas.web.test.ClinicaDeProblemasTest.java

@BeforeClass
public static void setUp() throws Exception {
    driver = new FirefoxDriver();
    // se define el url base del proyecto web
    baseUrl = "http://localhost:8080";
    /* Indica cuanto se espera para la respuesta de cualquier comando realizado hacia el navegador*/
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:co.edu.uniandes.csw.mpusedvehicle.functionalTest.CheckoutFunctionalIT.java

@BeforeClass
public static void setUp() {
    insertData();//from   w w  w  .j  a va2  s  .c o  m
    // Crea una instancia del driver de firefox sobre el que se ejecutara la aplicacion. 
    driver = new FirefoxDriver();

}

From source file:co.edu.uniandes.csw.RigitalApp.test.CMSTest.java

@BeforeClass
public static void setUp() throws Exception {
    driver = new FirefoxDriver();

    baseUrl = "http://localhost:8080";

    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:co.edu.uniandes.csw.sport.master.test.SportMasterTest.java

@BeforeClass
public static void setUp() throws Exception {
    driver = new FirefoxDriver();
    // se define el url base del proyecto web
    baseUrl = "http://localhost:8080";
    //* Indica cuanto se espera para la respuesta de cualquier comando realizado hacia el navegador*/.
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    /** Cambia el tamanio de la ventana del explorador para que los controles backbone se muestren correctamente en la prueba*/
    driver.manage().window().setSize(new Dimension(1400, 700));

}

From source file:co.edu.uniandes.csw.SportGroup.web.test.SportClubIT.java

@BeforeClass
public static void setUp() {
    // Se crea un ainstancia del driver de firefox sobre el que se ejecutara la aplicacin.
    driver = new FirefoxDriver();
    //        // Este timeout sirve para esperar que inicie el firefox
    //        driver.manage().timeouts().implicitlyWait(3000, TimeUnit.SECONDS);
}