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() 

Source Link

Usage

From source file:swift.selenium.Automation.java

License:Open Source License

/** Returns a FireFox Driver's Instance **/
public static WebDriver getFFDriverInstance() throws Exception {
    // TM: commented the following code as driver is defined global
    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference("network.automatic-ntlm-auth.trusted-uris", "masteknet.com");// for https
    return new FirefoxDriver(profile);
}

From source file:tests.SeleniumFireFox.java

License:Apache License

public static FirefoxDriver createFirefoxDriver() {
    FirefoxProfile profile = new FirefoxProfile();
    FirefoxDriver answer = new FirefoxDriver(profile);
    return answer;
}

From source file:uk.gov.gchq.gaffer.ui.QueryBuilderST.java

License:Apache License

@BeforeClass
public static void beforeClass() throws OperationException {
    assertNotNull("System property " + GECKO_PROPERTY + " has not been set",
            System.getProperty(GECKO_PROPERTY));
    url = System.getProperty(URL_PROPERTY, DEFAULT_URL);
    slowFactor = Integer.parseInt(System.getProperty(SLOW_FACTOR_PROPERTY, DEFAULT_SLOW_FACTOR));

    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference("intl.accept_languages", "en-GB"); // for dates
    driver = new FirefoxDriver(profile);

    // Create a large window to ensure we don't need to scroll
    final Dimension dimension = new Dimension(1200, 1000);
    driver.manage().window().setSize(dimension);
    addNamedOperation();/*from   w  w  w. j a va  2 s . co  m*/
}

From source file:uk.q3c.krail.testbench.KrailTestBenchTestCase.java

License:Apache License

protected FirefoxProfile createFirefoxProfile(Locale locale) {
    FirefoxProfile profile = new FirefoxProfile();
    String s1 = locale.toLanguageTag().toLowerCase().replace("_", "-");
    profile.setPreference("intl.accept_languages", s1);
    return profile;
}

From source file:Utility.NRICGenerator.java

public String nric_generator() throws InterruptedException {
    File pathfirefox = new File("C:\\Program Files\\Java\\firefox.exe");
    FirefoxProfile profile = new FirefoxProfile();
    driver = new FirefoxDriver(new FirefoxBinary(pathfirefox), profile);
    driver.get("http://xeroy.net/nric-generator/");
    Thread.sleep(5000);//from  w ww  .  jav a2s  . co  m

    WebElement element = driver.findElement(By.xpath("//input[@name='xeroyNRIC' and @class='Textfield']"));
    try {
        //JavascriptExecutor executor = (JavascriptExecutor)driver;
        //executor.executeScript("arguments[0].click();", element);
        Thread.sleep(1000);
    } catch (InterruptedException ex) {
        Logger.getLogger(NRICGenerator.class.getName()).log(Level.SEVERE, null, ex);
    }
    String nric = element.getAttribute("value");
    System.out.print("NRIC is generated : " + nric);
    return nric;

}

From source file:wsattacker.sso.openid.attacker.evaluation.SeleniumBrowser.java

License:Open Source License

public static WebDriver getWebDriver() {

    if (INSTANCE == null || hasQuit(INSTANCE) || INSTANCE.getWindowHandles().isEmpty()) {
        // create chrome profile
        //ChromeOptions options = new ChromeOptions();
        //options.addExtensions(new File("adblock.crx"));

        FirefoxProfile profile = new FirefoxProfile();

        // install adblock plus
        File tmpFile = new File("adblock.xpi");
        try {/*from w ww .j a  va  2  s  .c  o m*/
            InputStream inputStream = SeleniumBrowser.class.getResourceAsStream("/adblock_firefox.xpi");
            FileUtils.copyInputStreamToFile(inputStream, tmpFile);
            profile.addExtension(tmpFile);
        } catch (IOException ex) {
            Logger.getLogger(EvaluationGui.class.getName()).log(Level.SEVERE, null, ex);
        }

        // disable local and session storage
        // some websites (e.g. stackoverflow) use those storages in addition
        // to session cookies
        profile.setPreference("dom.storage.enabled", false);

        // start new Firefox instance
        INSTANCE = new FirefoxDriver(profile);

        // screen size
        GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        int width = gd.getDisplayMode().getWidth();
        int height = gd.getDisplayMode().getHeight();

        width = width > 1440 ? 1440 : width;
        height = height > 900 ? 900 : height;

        INSTANCE.manage().window().setPosition(new Point(0, 0));
        INSTANCE.manage().window().setSize(new Dimension(width, height));

        tmpFile.delete();
    }

    return INSTANCE;
}