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:connect.Connector.java

public static WebDriver init(String BrowserName) throws IOException {
    System.out.println(readFile().getProperty(BrowserName));
    if (readFile().getProperty(BrowserName).contains("chrome")) {

        System.setProperty("webdriver.chrome.driver",
                System.getProperty("user.dir") + "\\src\\driver\\chromedriver.exe");
        driver = new ChromeDriver();
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }//  w  w w  .  j  av  a  2s  .  c o  m
    if (BrowserName.contains("Firefox")) {
        WebDriver driver = new FirefoxDriver();
    }
    return driver;
}

From source file:crawl.CrawlThread.java

License:Open Source License

@Override
public void run() {
    WebDriver driver = new FirefoxDriver(); // The Firefox driver supports javascript 
    Autenticate.perform(driver, fb_email, fb_password);
    try {/*from w ww .j  a  v a  2 s .c  o  m*/
        Thread.sleep(Globals.TIME_TO_LOGIN_IN_FB_MS);
    } catch (Exception ex) {
        System.out.println("InterruptedException in crawl.run()");
        ex.printStackTrace();
        System.exit(-1);
    }
    for (String post_id : post_list) {
        //OPEN NEW TAB
        WebElement body = driver.findElement(By.tagName("body"));
        body.sendKeys(Keys.CONTROL + "t");
        Tree post = new Tree(post_id, GLOBALS);
        boolean result = post.crawl(driver);
        if (result) {
            post.prune();
            post.print();
            post.printEdgeList();
        } else {
            body.sendKeys(Keys.CONTROL + "w");
        }
        //SWITCH TAB
        ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
        driver.switchTo().window(tabs.get(tabs.size() - 1));
    }
    driver.quit();
}

From source file:crawling.SeleniumDemo.java

@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "https://paytm.com/shop/p/lenovo-k3-note-black-MOBLENOVO-K3-NOEURE618956FC31270?tracker=%7C%7C%7C%7C%2Fh%2Felectronics%2Fmobile-accessories%2Fmobiles-Incredible%20Offers%7C4173%7C1";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:crud.user.UserCadTest.java

@BeforeClass
public static void setUpClass() {
    driver = new FirefoxDriver();
    driver.get("http://localhost:8080/pfcTasker/planos.xhtml");
}

From source file:cucumber.scratch.maven.react.SeleniumConfiguration.java

License:Apache License

@Bean(destroyMethod = "quit")
public WebDriver driver(@Value("${web.driver:chrome}") String webDriver) {

    if ("chrome".equals(webDriver)) {
        return new ChromeDriver();
    }//  w w  w. j  av a  2s.c  o m

    if ("firefox".equals(webDriver)) {
        return new FirefoxDriver();
    }

    if ("ie".equals(webDriver)) {
        return new InternetExplorerDriver();
    }

    if ("safari".equals(webDriver)) {
        return new SafariDriver();
    }

    if ("opera".equals(webDriver)) {
        return new OperaDriver();
    }

    throw new IllegalArgumentException(format("Web driver %s not supported.", webDriver));
}

From source file:CucumberSelenium.EncontrarProfissionalCucumberSeleniumTest.java

protected void setUp() {

        try {// w  w  w  .jav  a2  s.c  o m
            driver = new FirefoxDriver();
            baseUrl = "http://deti-tqs-vm3.ua.pt/";
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        } catch (AbstractMethodError am) {
            am.printStackTrace();
        }
    }

From source file:CucumberSelenium.EntrarContactoCucumberSelenium.java

@Dado("^Eu abri o browser$")
public void abrirBrowser() throws Throwable {

    try {//www  . ja  va 2s .  c  o  m
        driver = new FirefoxDriver();
        baseUrl = "http://deti-tqs-vm3.ua.pt/";
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    } catch (AbstractMethodError am) {
        am.printStackTrace();
    }

}

From source file:CucumberSelenium.loginCucumberSeleniumTest.java

@Dado("^Eu abri o browser$")
 public void abrirBrowser() throws Throwable {

     try {//from   ww w  .j a  va  2s  . c  om
         driver = new FirefoxDriver();
         openBrowser = true;
     } catch (AbstractMethodError am) {
         am.printStackTrace();
     }

 }

From source file:dagaz.driver.RunningDriver.java

public WebDriver firefoxDriver() {
    DesiredCapabilities capabilites = new DesiredCapabilities();
    WebDriver driver = new FirefoxDriver();
    return driver;
}

From source file:Data.Database.java

public void addTeams() throws InterruptedException, FileNotFoundException {
    Scanner fileScanner = new Scanner(new File("login.txt"));
    String username = fileScanner.nextLine();
    String password = fileScanner.nextLine();

    WebDriver firefoxDriver = new FirefoxDriver();

    //Open the url which we want in firefox
    firefoxDriver.get("http://www.fantrax.com/fantasy/teamRosterChart.go?leagueId=ntokropui8nbbjt1");
    WebElement link;//from w  ww  . j a v  a 2  s  . com
    link = firefoxDriver.findElement(By.id("loginZone"));
    link.click();
    WebElement input;
    input = firefoxDriver.findElement(By.id("j_username"));
    input.sendKeys(username);
    input = firefoxDriver.findElement(By.id("realPassword"));
    input.sendKeys(password);
    input.sendKeys(Keys.RETURN);

    Thread.sleep(2000);
    firefoxDriver.get("http://www.fantrax.com/fantasy/teamRosterChart.go?leagueId=ntokropui8nbbjt1");
    String data = firefoxDriver.getPageSource();

    data = data.substring(data.indexOf("<table class=\"fantTable rosterChart\">"));
    data = data.substring(0, data.indexOf("</tbody>"));
    String[] temp = data.split("<td class=\"team leftCol\">");
    //System.out.println(temp[1]);

    for (int i = 1; i < temp.length; i++) {
        Team t = new Team();
        t.fillTeam(years, lookup, temp[i]);
        fh_teams.add(t);
        t.getTotals();
        t.printAverages();
    }

    firefoxDriver.quit();
}