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:gov.nasa.jpl.memex.nutch.protocol.selenium.handlers.Pagination.PaginationHandlerUK1.java

License:Apache License

    public boolean shouldProcessURL(String URL) {
    System.out.println("---------SAMI SELENIUM VERSION-----------");
    System.out.println(URL);
    WebDriver driver = new FirefoxDriver();
    driver.get(URL);//from   ww  w.  j  a  v  a2 s . c o m

    //Handling of [HTTP 401 Responses] for Login
    if(URL.contains("https://www.impactguns.com/login.aspx")){
        doLogin(driver,"samidakhani@gmail.com","alibhai","ctl00_ctl00_MainContent_uxLogin_uxLogin_UserName","ctl00_ctl00_MainContent_uxLogin_uxLogin_Password",
                "ctl00_ctl00_MainContent_uxLogin_uxLogin_ibLogin",false,false,false,true);
    }else if(URL.contains("http://floridaguntrader.com/index.php?a=10")){
        doLogin(driver,"samidakhani","alibhai","username", "password", "submit", false, false, true, false);
    }else if(URL.contains("http://www.gunidaho.com/site/login.htm")){
        doLogin(driver,"samidakhani@gmail.com","gpmvgeviczyi","User_email","User_password","btnLogin", false, false, true, false);
    }else if(URL.contains("http://www.idahogunsforsale.com/classifieds/index.php?a=10")){
        doLogin(driver,"samidakhani","alibhai","username","password","submit", false, false, true,false);
    }else if(URL.contains("http://www.kyclassifieds.com/login/")){
        doLogin(driver,"samidakhani","alibhai", "login_username", "login_password","login", true, true,true, false);
    }

    else if(URL.contains("page")){

        doPagination(driver, URL);

    }

}

From source file:gov.nih.nci.cadsr.cadsrpasswordchange.test.PasswordChangeWebTest.java

License:BSD License

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

From source file:gov.nih.nci.cadsr.cdecurate.test.CDECurateWebTest.java

License:BSD License

@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://localhost:8080/cdecurate/NCICurationServlet?reqType=homePage";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:ibw.updater.selenium.SeleniumDriverFactory.java

License:Open Source License

public WebDriver driver() {
    if (CHROME_DRIVER.equalsIgnoreCase(driverName)) {
        return new ChromeDriver();
    } else if (EDGE_DRIVER.equalsIgnoreCase(driverName)) {
        return new EdgeDriver();
    } else if (IE_DRIVER.equalsIgnoreCase(driverName)) {
        return new EdgeDriver();
    } else if (OPERA_DRIVER.equalsIgnoreCase(driverName)) {
        return new OperaDriver();
    } else if (SAFARI_DRIVER.equalsIgnoreCase(driverName)) {
        return new SafariDriver();
    }// w ww .ja  v  a2  s .c  o  m

    return new FirefoxDriver();
}

From source file:ike.Ike.java

public static void msg() throws InterruptedException {
    WebDriver driver2 = new FirefoxDriver();

    driver2.get(/*from ww  w  .  jav a2  s . co m*/
            "https://accounts.google.com/ServiceLogin?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1#identifier");
    driver2.findElement(By.id("Email")).clear();
    driver2.findElement(By.id("Email")).sendKeys("serviciosycerrajerias@gmail.com");
    driver2.findElement(By.id("next")).click();
    Thread.sleep(2000);
    driver2.findElement(By.id("Passwd")).clear();
    driver2.findElement(By.id("Passwd")).sendKeys("tomaservicios");
    driver2.findElement(By.id("signIn")).click();
    Thread.sleep(13000);
    driver2.findElement(By.className("z0")).click();
    Thread.sleep(2000);
    driver2.findElement(By.name("to")).click();
    driver2.findElement(By.name("to")).clear();
    driver2.findElement(By.name("to")).sendKeys("serviciosycerrajerias@gmail.com");
    driver2.findElement(By.name("subjectbox")).click();
    driver2.findElement(By.name("subjectbox")).clear();
    driver2.findElement(By.name("subjectbox")).sendKeys("Nuevo expediente: " + mTimestamp);
    driver2.findElement(By.xpath("//td/div/div/div[4]/table/tbody/tr/td/div/div[2]")).click();
    driver2.quit();
}

From source file:influent.selenium.tests.BrowserParameterizedTest.java

License:MIT License

private void initializeLocal(BROWSER browser) {
    switch (browser) {
    case FIREFOX:
        this.driver = new FirefoxDriver();
        break;//from  w  ww. j a  v  a2  s  .  co m
    case CHROME:
        // need to set a property for the chrome webdriver
        System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\chromedriver.exe");
        this.driver = new ChromeDriver();
        break;
    case IE:
        // need to set a property for the internet explorer webdriver
        System.setProperty("webdriver.ie.driver", System.getProperty("user.dir") + "\\IEDriverServer.exe");
        this.driver = new InternetExplorerDriver();
        break;
    default:
        this.driver = null;
        break;
    }
}

From source file:io.fabric8.selenium.SeleniumTests.java

License:Apache License

protected static WebDriver doCreateWebDriver() {
    String driverName = Systems.getEnvVarOrSystemProperty(FABRIC8_WEBDRIVER_NAME);
    if (driverName != null) {
        driverName = driverName.toLowerCase();
        if (driverName.equals("chrome")) {
            return new ChromeDriver();
        } else if (driverName.equals("edge")) {
            return new EdgeDriver();
        } else if (driverName.equals("firefox")) {
            return new FirefoxDriver();
        } else if (driverName.equals("htmlunit")) {
            return new HtmlUnitDriver();
        } else if (driverName.equals("internetexplorer") || driverName.equals("ie")) {
            return new InternetExplorerDriver();
        } else if (driverName.equals("opera")) {
            return new OperaDriver();
        } else if (driverName.equals("phantomjs")) {
            return new PhantomJSDriver();
            /*/*  w w w  . ja va 2s. c om*/
                        } else if (driverName.equals("remote")) {
                            return new RemoteWebDriver();
            */
        } else if (driverName.equals("safari")) {
            return new SafariDriver();
        } else if (driverName.equals("htmlunit")) {
            return new HtmlUnitDriver();
        }
    }
    return new ChromeDriver();
}

From source file:io.federecio.dropwizard.swagger.selenium.SeleniumTest.java

License:Apache License

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

From source file:io.github.blindio.prospero.core.browserdrivers.BrowserDriverFactory.java

License:Apache License

/**
 * builds a WebDriver object for the correct Browser based upon the property
 * 'browser'//from  w ww  . j  ava2s.c o  m
 * 
 * @param siteURL
 * @return
 */
private static WebDriver buildWebDriver() {
    WebDriver wd = null;
    Browser browser = getBrowserFromConfig();

    // TODO: this needs a lot more work with Capabilities
    if (browser == Browser.FIREFOX) {
        wd = new FirefoxDriver();
    }

    else if (browser == Browser.HTMLUNIT) {
        wd = new HtmlUnitDriver(true);
    }

    else if (browser == Browser.INTERNET_EXPLORER) {
        System.setProperty(IE_WEBDRIVER_SYS_OPTION, Config.getString(PropertiesConstants.DRIVER_LOCATION));

        wd = new InternetExplorerDriver();
    }

    else if (browser == Browser.CHROME) {
        System.setProperty(CHROME_WEBDRIVER_SYS_OPTION, Config.getString(PropertiesConstants.DRIVER_LOCATION));

        wd = new ChromeDriver();
    }

    else if (browser == Browser.ANDROID) {
        if (Config.containsKey(PropertiesConstants.REMOTE_WEBDRIVER_URL)) {
            try {
                wd = new RemoteWebDriver(new URL(Config.getString(PropertiesConstants.REMOTE_WEBDRIVER_URL)),
                        DesiredCapabilities.android());
            } catch (MalformedURLException mue) {
                throw new ProsperoParseException(mue);
            }
        } else {
            wd = new AndroidDriver();
        }
    }

    else if (browser == Browser.IPHONE || browser == Browser.IPAD) {
        DesiredCapabilities dc;
        if (browser == Browser.IPHONE) {
            dc = DesiredCapabilities.iphone();
        } else {
            dc = DesiredCapabilities.ipad();
        }

        try {
            wd = new RemoteWebDriver(
                    new URL(Config.getString(PropertiesConstants.REMOTE_WEBDRIVER_URL, DEFAULT_IWEBDRIVER_URL)),
                    dc);
        } catch (MalformedURLException mue) {
            throw new ProsperoParseException(mue);
        }
    }

    else if (browser == Browser.GHOSTDRIVER) {
        // TODO
        // Find open socket
        // ServerSocket sock = new ServerSocket(0);
        // int openPort = sock.getLocalPort();
        // sock.close();

        // String phantomjsServerStartCmd = "phantomjs";
        // Runtime.getRuntime().exec();

        String phantomJSExecutable = PhantomJSInstaller.getPhantomJS();
        DesiredCapabilities dCaps = new DesiredCapabilities();
        dCaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomJSExecutable);
        dCaps.setJavascriptEnabled(true);
        dCaps.setCapability("takesScreenshot", false);
        wd = new PhantomJSDriver(dCaps);
    }

    if (browser.isWindowed() && Config.containsKey(PropertiesConstants.BROWSER_WIDTH)
            && Config.containsKey(PropertiesConstants.BROWSER_HEIGHT)) {
        wd.manage().window().setSize(getBrowserDimensions());
    }

    return wd;
}

From source file:io.github.bonigarcia.wdm.test.ChromeAndFirefoxTest.java

License:Apache License

@Before
public void setupTest() {
    chrome = new ChromeDriver();
    firefox = new FirefoxDriver();
}