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:co.flexmod.selenium.example.integration.framework.WebDriverFactory.java

License:Apache License

public static WebDriver create(String browser) {
    if (browser.equalsIgnoreCase("firefox")) {
        return new FirefoxDriver();
    } else if (browser.equalsIgnoreCase("chrome")) {
        return new ChromeDriver();
    } else if (browser.equalsIgnoreCase("ie")) {
        return new InternetExplorerDriver();
    } else if (browser.equalsIgnoreCase("html")) {
        HtmlUnitDriver htmlUnitDriver = new HtmlUnitDriver(BrowserVersion.FIREFOX_24);
        htmlUnitDriver.setJavascriptEnabled(true);
        return htmlUnitDriver;
    } else {/* www .j  av  a  2s  .  co  m*/
        throw new IllegalArgumentException("The Browser Type is Undefined");
    }
}

From source file:co.uniandes.csw.ClinicaDeProblemas.test.ComentarioTest.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:com.alfonsogalvanmadera.robot.Leer.java

/**
 * @param args the command line arguments
 *//*w  w  w.jav  a  2s  .  com*/
public static void main(String[] args) throws Exception {
    // TODO code application logic here
    DAOCadena2 daoc = new DAOCadena2();
    DAOCliente2 daoc1 = new DAOCliente2();
    DAOAccion2 daoa = new DAOAccion2();
    DAODato2 daod = new DAODato2();

    Cadena2 cadena = daoc.bucarCadena(3);
    Cliente2 c = daoc1.buscarCliente(3);
    Accion2 a = daoa.bucarAccion2(3);
    Dato2 d = daod.buscarDato2(3);
    //cad
    WebDriver driver = new FirefoxDriver();
    driver.get(cadena.getUrl());
    //driver.findElement(By.name(cadena.getUrl()));
    driver.findElement(By.id(d.getCampoLogin())).sendKeys(c.getUsuario());

    driver.findElement(By.id(d.getCampoPass())).sendKeys(c.getPass());
    driver.findElement(By.name(a.getAccion())).click();

}

From source file:com.amolik.scrapers.OdishaRationCardScraper.java

public static void main(String[] args) throws Exception {
    ;//from  w  ww .jav  a2  s  .c  om

    // The Firefox driver supports javascript 
    WebDriver driver = new FirefoxDriver();

    driver.get(AmolikProperties.getProperty("odisha_ration.startUrl"));
    baseDir = AmolikProperties.getProperty("odisha_ration.baseDir");
    excelTemplateFileName = AmolikProperties.getProperty("odisha_ration.excelTemplateFileName");
    excelFileExtension = AmolikProperties.getProperty("odisha_ration.excelExtension");

    if (logger.isInfoEnabled()) {

        logger.info("startUrl=" + AmolikProperties.getProperty("odisha_ration.startUrl"));
    }

    processAllDistricts(driver);

    if (driver != null) {

        driver.close();

    }
}

From source file:com.androidwhy.modules.test.selenium.WebDriverFactory.java

License:Apache License

/**
 * ?driverName??WebDriver./*from  w w w  . j a v a  2 s  .c o  m*/
 * 
 * ????Windows, IE?XWindows, ?remote driverWindows.
 * drivernameremote:192.168.0.2:4444:firefox, ??http://192.168.0.2:4444/wd/hub?selenium 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 (BrowserType.chrome.name().equals(driverName)) {
        driver = new ChromeDriver();
    } else if (BrowserType.htmlunit.name().equals(driverName)) {
        driver = new HtmlUnitDriver(true);
    } 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:4444: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();
        } else if (BrowserType.chrome.name().equals(driverType)) {
            cap = DesiredCapabilities.chrome();
        }

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

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

    return driver;
}

From source file:com.asiainfo.tfsPlatform.modules.test.selenium.WebDriverFactory.java

License:Apache License

/**
 * ?driverName??WebDriver.//  w  ww .  j av a 2 s .  c  o m
 * 
 * ??firefox,ie,chrome??.
 * 
 * ????Windows, IE?XWindows, ???remote driverWindows.
 * drivernameremote:192.168.0.2:4444:firefox, ??http://192.168.0.2:4444/wd/hub?selenium remote?.
 */
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 (BrowserType.chrome.name().equals(driverName)) {
        driver = new ChromeDriver();
    } else if (driverName.startsWith(BrowserType.remote.name())) {
        String[] params = driverName.split(":");
        Validate.isTrue(params.length == 4,
                "Remote driver is not right, accept format is \"remote:localhost:4444:firefox\", but the input is\""
                        + driverName + "\"");

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

        String remoteUrl = "http://" + remoteHost + ":" + remotePort + "/wd/hub";

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

        try {
            driver = new RemoteWebDriver(new URL(remoteUrl), cap);
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
    }

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

    return driver;
}

From source file:com.atf.webtest.factory.BrowserFactory.java

public static WebDriver getFirefoxBrowser() {
    driver = new FirefoxDriver();
    return driver;
}

From source file:com.blogspot.jadecalyx.webtools.jcBrowser.java

private void initDriver(String browserType) {
    switch (browserType.toLowerCase()) {
    case "chrome":
        ChromeDriverManager.getInstance().setup();
        _driver = new ChromeDriver();
        break;/*from  w w  w  . ja  v a  2  s  .c o  m*/
    case "firefox":
        _driver = new FirefoxDriver();
        break;
    default:
        System.out.println("Unable to find browser");
        break;
    }
}

From source file:com.bna.ezrxlookup.ui.web.EZRxBusinessTests.java

License:Apache License

@Before
public void setUp() throws Exception {
    driver = (WebDriver) new FirefoxDriver();
    baseUrl = "http://52.7.4.133:8080"; //Ideally this should be local hosts and all test will be run in a docker container
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:com.bna.ezrxlookup.ui.web.EZRxInitialPage.java

License:Apache License

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

}