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:at.jps.slcm.SlcmTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    setDriver(new FirefoxDriver()); // Firefox

    // To use Chrome, first install chromedriver.exe from
    // http://chromedriver.storage.googleapis.com/index.html
    // on your system path (e.g. C:\Windows\System32\)
    //   setDriver(new ChromeDriver()); // Chrome

    // To use Internet Explorer, first install iedriverserver.exe from
    // http://selenium-release.storage.googleapis.com/index.html?path=2.43/
    // on your system path (e.g. C:\Windows\System32\)
    //   setDriver(new InternetExplorerDriver()); // IE

    // To test headlessly (without a browser), first install phantomjs.exe
    // from http://phantomjs.org/download.html on your system path
    // (e.g. C:\Windows\System32\)
    //   setDriver(new PhantomJSDriver()); // PhantomJS headless browser
}

From source file:atd.selenium.RegisterUser.java

License:Open Source License

@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "https://atd.plebian.nl/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:au.com.onegeek.lambda.core.BrowserFactory.java

License:Apache License

/**
 * Factory method that creates a OS \ architecture independent WebDriver based on the browser
 * requested./* ww w . ja  va2 s  .c o m*/
 * 
 * @param browser    The name of the browser to create. Currently supports Firefox,
 *                  Chrome, IE, HTMLUnit and null. Default is HTMLunit if none
 *                  supplied. Parameter is case insensitive..
 * @return The WebDriver to run the tests.
 * @throws Exception
 */
public static WebDriver getDriver(String browser) throws Exception {
    WebDriver driver = null;

    // HTMLUnit is default browser
    if (browser == null || browser.equalsIgnoreCase("htmlunit") || browser.trim().equalsIgnoreCase("")) {
        logger.debug("Creating new HTMLUnit driver");
        driver = new HtmlUnitDriver();
    } else if (browser.equalsIgnoreCase("firefox")) {
        logger.debug("Creating new Firefox driver");
        driver = new FirefoxDriver();
    } else if (browser.equalsIgnoreCase("opera")) {
        logger.debug("Creating new Opera driver");
        driver = new OperaDriver();
    } else if (browser.equalsIgnoreCase("chrome")) {

        logger.debug("Creating new Chrome driver");
        // Chrome has it's own web driver implementation, need to specify the property 'webdriver.chrome.driver'
        Properties props = System.getProperties();

        if (System.getProperty("webdriver.chrome.driver") == null) {
            // Create a new instance of the Chrome driver
            // Notice that the remainder of the code relies on the interface,
            // not the implementation.
            Enumeration e = props.propertyNames();

            while (e.hasMoreElements()) {
                String key = (String) e.nextElement();
                logger.debug("key {} -- value{}", key, props.getProperty(key));
            }

            String os = System.getProperty("os.name");
            String arch = System.getProperty("sun.arch.data.model");
            String currentDir = new File(".").getAbsolutePath();

            // Check OS
            if (os.indexOf("Mac OS X") > -1) {
                //capabilities.setCapability("chrome.binary", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
                System.setProperty("webdriver.chrome.driver", currentDir + "/lib/chromedriver-macosx");
            } else if (arch.equalsIgnoreCase("32") && os.indexOf("Linux") > -1) {
                System.setProperty("webdriver.chrome.driver", currentDir + "/lib/chromedriver-linux32");
            } else if (arch.equalsIgnoreCase("64") && os.indexOf("Linux") > -1) {
                System.setProperty("webdriver.chrome.driver", currentDir + "/lib/chromedriver-linux64");
            } else if (os.indexOf("Linux") > -1) {
                System.setProperty("webdriver.chrome.driver", currentDir + "/lib/chromedriver-linux32");
            } else if (os.indexOf("Windows") > -1) {
                System.setProperty("webdriver.chrome.driver", currentDir + "/lib/chromedriver.exe");
            } else {
                throw new Exception("Cannot find WebDriver for os, therefore cannot run these tests: " + os);
            }
        }

        logger.debug("Chrome driver binary: " + System.getProperty("webdriver.chrome.driver"));
        //         driver = new ChromeDriver(capabilities);
        driver = new ChromeDriver();
    } else if (browser.equalsIgnoreCase("ie") || browser.equalsIgnoreCase("iexplore")) {
        logger.debug("Creating new Internet Explorer driver");
        driver = new InternetExplorerDriver();
    } else {
        throw new BrowserNotFoundException("Browser " + browser + " not supported.");
    }

    return driver;
}

From source file:au.edu.qtac.admission.webtest.DragAndDropTest.java

@Before
public void loadPage() {
    driver = new FirefoxDriver();
}

From source file:automated_tests.InitialPopups.java

@Parameters("browser")
@BeforeClass//w w  w  .jav  a 2 s. co  m
public static void beforeTest(String browser) {
    //set browser driver
    if (browser.equalsIgnoreCase("firefox")) {
        System.setProperty("webdriver.gecko.driver", "C:\\webDrivers\\geckodriver.exe");
        driver = new FirefoxDriver();
        System.out.println("Set for browser " + browser);
    } else if (browser.equalsIgnoreCase("chrome")) {
        System.setProperty("webdriver.chrome.driver", "C:\\webDrivers\\chromedriver.exe");
        driver = new ChromeDriver();
        System.out.println("Set for browser " + browser);
    } else if (browser.equalsIgnoreCase("ie")) {
        System.setProperty("webdriver.ie.driver", "C:\\webDrivers\\IEDriverServer.exe");
        driver = new InternetExplorerDriver();
        System.out.println("Set for browser " + browser);
    }
    //Opera and IE only work on Windows?
    // System.setProperty("webdriver.opera.driver","/Users/catherineszeto/Documents/workspace/MPN/operadriver");
    // driver = new OperaDriver();
    // System.setProperty("webdriver.ie.driver","/Users/catherineszeto/Documents/workspace/MPN/IEDriverServer.exe");
    // driver = new InternetExplorerDriver();
    else {
        System.out.println("Driver not configured for browser " + browser);
    }

    wait = new WebDriverWait(driver, 20);
    //set base URL

}

From source file:automation.CenturyLink.java

@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "https://kai04.centurylink.com/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:automation.HE.java

@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://lg.he.net/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:automation.PCCWGlobalcom.java

@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://lookingglass.pccwglobal.com/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:automation.Zayo.java

@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://lg.zayo.com/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:automatizados.Script01.java

@Before
public void setUp() {
    driver = new FirefoxDriver();
    driver.get("http://localhost:8080/projetoTesteSelenium/");
}