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

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

Introduction

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

Prototype

public FirefoxProfile(File profileDir) 

Source Link

Document

Constructs a firefox profile from an existing profile directory.

Usage

From source file:edu.uga.cs.clickminer.ClickminerCLI.java

License:Open Source License

private static Pair<DesiredCapabilities, FirefoxProfile> createBrowserConfig(CommandLine cli)
        throws ParseException {
    DesiredCapabilities cap = new DesiredCapabilities();
    FirefoxProfile profile = null;//from w  w w. j  a v a2 s  .  c o m
    String profilepath = cli.getOptionValue('P');
    if (profilepath != null) {
        profile = new FirefoxProfile(new File(profilepath));
    } else {
        profile = new FirefoxProfile();
    }

    setProxyConfig(cli.getOptionValue('h'), ((Number) cli.getParsedOptionValue("p")).intValue(), cap);
    setBrowserLoggingConfig(cli.getOptionValue("Lo"), cli.getOptionValue("Ld"), cap, profile);
    if (cli.hasOption("u")) {
        setUnstableLoadingConfig(profile);
    }

    return new ImmutablePair<DesiredCapabilities, FirefoxProfile>(cap, profile);
}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_5.</p>
 *///from ww  w . j  a va  2s . c om
public static void browserEngineTest_5() {
    ProxyClient pc = new ProxyClient("127.0.0.1", 8888);

    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    profile.setEnableNativeEvents(true);
    RemoteWebDriver wdriver = new FirefoxDriver(
            new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-12/firefox")), profile,
            TestUtils.createProxyConfig());

    BrowserEngine bengine = new BrowserEngine(pc, wdriver);
    bengine.run();
    List<InteractionRecord> ilog = bengine.getInteractionLog();
    JSONWriter<InteractionRecord> writer = new JSONWriter<InteractionRecord>();
    try {
        writer.write(new File("/home/cjneasbi/Desktop/ilog.json"), ilog);
    } catch (Exception e) {
        if (log.isErrorEnabled()) {
            log.error("", e);
        }
    }
    bengine.close();
}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_9.</p>
 *//* ww w  . j a  v  a2s.  co m*/
public static void browserEngineTest_9() {
    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    WebDriver wdriver = new FirefoxDriver(
            new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-14.0.1/firefox-bin")),
            profile, TestUtils.createProxyConfig());
    ProxyClient pc = new ProxyClient("127.0.0.1", 8888);
    BrowserEngine bengine = new BrowserEngine(pc, wdriver);
    try {
        bengine.run();
    } catch (Exception e) {
        e.printStackTrace();
    }
    List<InteractionRecord> ilog = bengine.getInteractionLog();
    JSONWriter<InteractionRecord> writer = new JSONWriter<InteractionRecord>();
    try {
        writer.write(new File("/home/cjneasbi/Desktop/mined_clicks.json"), ilog);
    } catch (Exception e) {
        if (log.isErrorEnabled()) {
            log.error("", e);
        }
    }
    bengine.close();
}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_10.</p>
 *///w w  w  .  j  av  a 2  s  .  co  m
public static void browserEngineTest_10() {
    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    WebDriver wdriver = new FirefoxDriver(null, profile);

    wdriver.get("http://www.dkfjaojfko.com");
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    System.out.println(wdriver.getCurrentUrl());
    System.out.println(wdriver.getTitle());
    System.out.println(wdriver.getPageSource());
    wdriver.quit();
}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_11.</p>
 *///from w ww. j  av a2  s  .  co m
public static void browserEngineTest_11() {
    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    WebDriver wdriver = new FirefoxDriver(null, profile, TestUtils.createProxyConfig());
    //ProxyClient pc = new ProxyClient("127.0.0.1", 8888);
    //BrowserEngine bengine = new BrowserEngine(pc, wdriver);

    wdriver.get("http://cnn-f.akamaihd.net/crossdomain.xml");
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    List<WebElement> sresult = wdriver.findElements(By.xpath("//*"));
    for (WebElement elem : sresult) {
        System.out.println(elem.getTagName());
    }
}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_12.</p>
 *///from w w  w .j  a va2s . c  o m
public static void browserEngineTest_12() {
    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    WebDriver wdriver = new FirefoxDriver(
            new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-14.0.1/firefox-bin")),
            profile, TestUtils.createProxyConfig());
    ProxyClient pc = new ProxyClient("127.0.0.1", 8888);
    BrowserEngine bengine = new BrowserEngine(pc, wdriver, true, true);
    try {
        bengine.run();
    } catch (Exception e) {
        e.printStackTrace();
    }
    List<InteractionRecord> ilog = bengine.getInteractionLog();
    JSONWriter<InteractionRecord> writer = new JSONWriter<InteractionRecord>();
    try {
        writer.write(new File("/home/cjneasbi/Desktop/mined_clicks_js.json"), ilog);
    } catch (Exception e) {
        if (log.isErrorEnabled()) {
            log.error(e);
        }
    }
    bengine.close();
}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_13.</p>
 *
 * @throws edu.uga.cs.clickminer.exception.ProxyErrorException if any.
 */// ww w .ja v a2  s  . c  om
public static void browserEngineTest_13() throws ProxyErrorException {
    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    WebDriver wdriver = new FirefoxDriver(
            new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-14.0.1/firefox-bin")),
            profile, TestUtils.createProxyConfig());
    ProxyClient pc = new ProxyClient("127.0.0.1", 8888);
    pc.setRequestCheckLimit(3);
    BrowserEngine bengine = new BrowserEngine(pc, wdriver);
    try {
        bengine.run();
    } catch (Exception e) {
        e.printStackTrace();
    }
    List<InteractionRecord> ilog = bengine.getInteractionLog();
    JSONWriter<InteractionRecord> writer = new JSONWriter<InteractionRecord>();
    try {
        writer.write(new File("/home/cjneasbi/Desktop/mined_clicks.json"), ilog);
    } catch (Exception e) {
        if (log.isErrorEnabled()) {
            log.error("", e);
        }
    }
    bengine.close();
}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_14.</p>
 *
 * @throws edu.uga.cs.clickminer.exception.ProxyErrorException if any.
 *//*w ww .j  a  v a  2s . c o m*/
public static void browserEngineTest_14() throws ProxyErrorException {
    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    WebDriver wdriver = new FirefoxDriver(
            new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-14.0.1/firefox-bin")),
            profile, TestUtils.createProxyConfig());
    ProxyClient pc = new ProxyClient("127.0.0.1", 8888);
    pc.setRequestCheckLimit(3);
    BrowserEngine bengine = new BrowserEngine(pc, wdriver, true, true);
    try {
        bengine.run();
    } catch (Exception e) {
        e.printStackTrace();
    }
    List<InteractionRecord> ilog = bengine.getInteractionLog();
    JSONWriter<InteractionRecord> writer = new JSONWriter<InteractionRecord>();
    try {
        writer.write(new File("/home/cjneasbi/Desktop/mined_clicks_js.json"), ilog);
    } catch (Exception e) {
        if (log.isErrorEnabled()) {
            log.error("", e);
        }
    }
    bengine.close();
}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_15.</p>
 *//*ww w. j  a va2  s .c o  m*/
public static void browserEngineTest_15() {
    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    WebDriver wdriver = new FirefoxDriver(
            new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-14.0.1/firefox-bin")),
            profile);
    wdriver.get("http://www.cs.uga.edu/~neasbitt/");
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    WebElement elem = wdriver.findElement(By.id("logo"));
    JSUtils.setElementAttribute(wdriver, elem, "id", "logologologo1");

    try {
        elem = wdriver.findElement(By.id("logologologo1"));
        System.out.println("Pass");
    } catch (NoSuchElementException e) {
        System.out.println("Fail");
    }
    wdriver.close();

}

From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java

License:Open Source License

/**
 * <p>browserEngineTest_16.</p>
 *
 * @throws java.io.IOException if any./* ww w  .  ja  v a 2  s  .  c  o  m*/
 * @throws java.lang.InterruptedException if any.
 */
public static void browserEngineTest_16() throws IOException, InterruptedException {
    FirefoxProfile profile = new FirefoxProfile(
            TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver"));
    WebDriver wdriver = new FirefoxDriver(
            new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-17.0/firefox-bin")),
            profile);
    // WebDriver wdriver = new FirefoxDriver();
    wdriver.get("http://www.cs.uga.edu/~neasbitt/");
    wdriver.switchTo().activeElement();

    Thread.sleep(10000);

    WebElement elem = wdriver.findElement(By.id("logo"));
    List<String> locator = JSUtils.getElementLocator(wdriver, elem);

    for (String s : locator) {
        System.out.println(s);
    }
    wdriver.close();
}