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

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

Introduction

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

Prototype

public void setAlwaysLoadNoFocusLib(boolean loadNoFocusLib) 

Source Link

Document

Sets whether the no focus library should always be loaded on Linux.

Usage

From source file:org.jboss.pressgang.ccms.page.WebDriverFactory.java

License:Open Source License

private FirefoxProfile makeFirefoxProfile() {
    if (!Strings.isNullOrEmpty(System.getProperty("webdriver.firefox.profile"))) {
        throw new RuntimeException("webdriver.firefox.profile is ignored");
        // TODO - look at FirefoxDriver.getProfile().
    }//from   w  w  w.  j a v  a  2  s.c om
    final FirefoxProfile firefoxProfile = new FirefoxProfile();

    /*
     * TODO: Evaluate need for this
     * Disable unnecessary connection to sb-ssl.google.com
     * firefoxProfile.setPreference("browser.safebrowsing.malware.enabled", false);
     */

    firefoxProfile.setAlwaysLoadNoFocusLib(true);
    firefoxProfile.setEnableNativeEvents(true);
    firefoxProfile.setAcceptUntrustedCertificates(true);
    return firefoxProfile;
}

From source file:org.zanata.page.WebDriverFactory.java

License:Open Source License

private FirefoxProfile makeFirefoxProfile() {
    if (!Strings.isNullOrEmpty(System.getProperty("webdriver.firefox.profile"))) {
        throw new RuntimeException("webdriver.firefox.profile is ignored");
        // TODO - look at FirefoxDriver.getProfile().
    }// w ww  . j  ava  2 s .  c o m
    final FirefoxProfile firefoxProfile = new FirefoxProfile();
    firefoxProfile.setAlwaysLoadNoFocusLib(true);
    firefoxProfile.setEnableNativeEvents(true);
    firefoxProfile.setAcceptUntrustedCertificates(true);
    // TODO port zanata-testing-extension to firefox
    //        File file = new File("extension.xpi");
    //        firefoxProfile.addExtension(file);
    return firefoxProfile;
}

From source file:plugins.KerberosSsoTest.java

License:Open Source License

private FirefoxDriver getNegotiatingFirefox(KerberosContainer kdc, String tokenCache) {
    FirefoxProfile profile = new FirefoxProfile();
    profile.setAlwaysLoadNoFocusLib(true);
    // Allow auth negotiation for jenkins under test
    profile.setPreference("network.negotiate-auth.trusted-uris", jenkins.url.toExternalForm());
    profile.setPreference("network.negotiate-auth.delegation-uris", jenkins.url.toExternalForm());
    FirefoxBinary binary = new FirefoxBinary();
    // Inject config and TGT
    binary.setEnvironmentProperty("KRB5CCNAME", tokenCache);
    binary.setEnvironmentProperty("KRB5_CONFIG", kdc.getKrb5ConfPath());
    // Turn debug on
    binary.setEnvironmentProperty("KRB5_TRACE", diag.touch("tracelog").getAbsolutePath());
    binary.setEnvironmentProperty("NSPR_LOG_MODULES", "negotiateauth:5");
    binary.setEnvironmentProperty("NSPR_LOG_FILE", diag.touch("firefox.nego.log").getAbsolutePath());

    String display = FallbackConfig.getBrowserDisplay();
    if (display != null) {
        binary.setEnvironmentProperty("DISPLAY", display);
    }//from w w w . j  av a  2  s .co m
    final FirefoxDriver driver = new FirefoxDriver(binary, profile);
    cleaner.addTask(new Statement() {
        @Override
        public void evaluate() throws Throwable {
            try {
                driver.quit();
            } catch (UnreachableBrowserException ex) {
                System.err.println("Browser died already");
                ex.printStackTrace();
            }
        }

        @Override
        public String toString() {
            return "Close Kerberos WebDriver after test";
        }
    });
    return driver;
}