Package org.openqa.selenium.firefox

Examples of org.openqa.selenium.firefox.FirefoxProfile


    }

    else if (name.equals("firefox")) {
      java.io.File profileDir = new java.io.File(
          System.getProperty("wasavi.tests.firefox.profile_path"));
      FirefoxProfile p = new FirefoxProfile(profileDir);

      p.setPreference("general.useragent.locale", "en-US");
      driver = new FirefoxDriver(p);
    }

    return driver;
  }
View Full Code Here


        // only profile was specified
        else if (Validate.empty(binary)) {
            Validate.isValidPath(profile, "Firefox profile does not point to a valid path " + profile);

            return SecurityActions.newInstance(configuration.getImplementationClass(), new Class<?>[] { FirefoxProfile.class },
                    new Object[] { new FirefoxProfile(new File(profile)) }, FirefoxDriver.class);
        }
        // both were specified
        else {
            Validate.isValidPath(profile, "Firefox profile does not point to a valid path,  " + profile);
            Validate.isExecutable(binary, "Firefox binary does not point to a valid executable,  " + binary);

            return SecurityActions.newInstance(configuration.getImplementationClass(), new Class<?>[] { FirefoxBinary.class,
                    FirefoxProfile.class }, new Object[] { new FirefoxBinary(new File(binary)),
                    new FirefoxProfile(new File(profile)) }, FirefoxDriver.class);
        }
    }
View Full Code Here

  }

  private EmbeddedBrowser newFireFoxBrowser(ImmutableSortedSet<String> filterAttributes,
          long crawlWaitReload, long crawlWaitEvent) {
    if (configuration.getProxyConfiguration() != null) {
      FirefoxProfile profile = new FirefoxProfile();
      String lang = configuration.getBrowserConfig().getLangOrNull();
      if (!Strings.isNullOrEmpty(lang)) {
        profile.setPreference("intl.accept_languages", lang);
      }

      profile.setPreference("network.proxy.http", configuration
              .getProxyConfiguration().getHostname());
      profile.setPreference("network.proxy.http_port", configuration
              .getProxyConfiguration().getPort());
      profile.setPreference("network.proxy.type", configuration
              .getProxyConfiguration().getType().toInt());
      /* use proxy for everything, including localhost */
      profile.setPreference("network.proxy.no_proxies_on", "");

      return WebDriverBackedEmbeddedBrowser.withDriver(new FirefoxDriver(profile),
              filterAttributes, crawlWaitReload, crawlWaitEvent);
    }

View Full Code Here

  private static FirefoxDriver initDriver() {
    File torProfileDir
        = new File(torbrowserHome + File.separator + "Data" + File.separator +
        "Browser" + File.separator + "profile.default");
    FirefoxBinary binary = new FirefoxBinary(new File(torbrowserHome + File.separator + "Start Tor Browser.exe"));
    FirefoxProfile torProfile = new FirefoxProfile(torProfileDir);
    torProfile.setPreference("webdriver.load.strategy", "unstable");

    try {
      binary.startProfile(torProfile, torProfileDir, "");
    } catch (IOException e) {
      e.printStackTrace();
    }

    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference("network.proxy.type", 1);
    profile.setPreference("network.proxy.socks", "127.0.0.1");
    profile.setPreference("network.proxy.socks_port", 9150);
    FirefoxDriver firefoxDriver = new FirefoxDriver(profile);
    firefoxDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
    return firefoxDriver;
  }
View Full Code Here

    }

    protected WebDriver createFireFoxWebDriver() throws Exception {
        File profile = new File(profileDir, "firefox");
        profile.mkdirs();
        return new FirefoxDriver(new FirefoxProfile(profile));
    }
View Full Code Here

  }

  @Before
  public void setUp() throws Exception {
    super.setUp();
    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference("intl.accept_languages", getLocale());
    driver = new FirefoxDriver(profile);
  }
View Full Code Here

  }

  private EmbeddedBrowser newFireFoxBrowser(ImmutableSortedSet<String> filterAttributes,
          long crawlWaitReload, long crawlWaitEvent) {
    if (configuration.getProxyConfiguration() != null) {
      FirefoxProfile profile = new FirefoxProfile();
      String lang = configuration.getBrowserConfig().getLangOrNull();
      if (!Strings.isNullOrEmpty(lang)) {
        profile.setPreference("intl.accept_languages", lang);
      }

      profile.setPreference("network.proxy.http", configuration.getProxyConfiguration()
              .getHostname());
      profile.setPreference("network.proxy.http_port", configuration
              .getProxyConfiguration().getPort());
      profile.setPreference("network.proxy.type", configuration.getProxyConfiguration()
              .getType().toInt());
      /* use proxy for everything, including localhost */
      profile.setPreference("network.proxy.no_proxies_on", "");

      return WebDriverBackedEmbeddedBrowser.withDriver(new FirefoxDriver(profile),
              filterAttributes, crawlWaitReload, crawlWaitEvent);
    }

View Full Code Here

import java.io.File;
import java.io.IOException;

public class Firebug {
    public static void configure(File dir, DesiredCapabilities capabilities) throws IOException {
        FirefoxProfile profile = new FirefoxProfile();
        profile.addExtension(new File(dir, "firebug-1.9.2-fx.xpi"));
        profile.addExtension(new File(dir, "netExport-0.8b22.xpi"));

        profile.setPreference("extensions.firebug.defaultPanelName", "net");
        profile.setPreference("extensions.firebug.net.enableSites", true);
        profile.setPreference("extensions.firebug.allPagesActivation", "on");
        profile.setPreference("extensions.firebug.showFirstRunPage", false);
        profile.setPreference("extensions.firebug.netexport.defaultLogDir", "/tmp");
        profile.setPreference("extensions.firebug.netexport.saveFiles", true);
        profile.setPreference("extensions.firebug.netexport.alwaysEnableAutoExport", true);

        capabilities.setCapability(FirefoxDriver.PROFILE, profile);
    }
View Full Code Here

        }
        if (Validate.nonEmpty(profile)) {
            Validate.isValidPath(profile, "Firefox profile does not point to a valid path " + profile);
        }

        FirefoxProfile firefoxProfile = new FirefoxProfile();
        capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);

        final String firefoxExtensions = (String) capabilities.getCapability("firefoxExtensions");
        // no check is needed here, it will return empty array if null
        for (String extensionPath : StringUtils.tokenize(firefoxExtensions)) {
            try {
                firefoxProfile.addExtension(new File(extensionPath));
            } catch (IOException e) {
                throw new IllegalArgumentException("Cannot read XPI extension file: " + extensionPath, e);
            }
        }
View Full Code Here

    Runnable gitblitRunnable = new GitblitRunnable(HTTP_PORT, HTTPS_PORT,
        SHUTDOWN_PORT, GITBLIT_PROPERTIES_PATH, USERS_PROPERTIES_PATH);

    serverThread = new Thread(gitblitRunnable);
    serverThread.start();
    FirefoxProfile firefoxProfile = new FirefoxProfile();
    firefoxProfile.setPreference("startup.homepage_welcome_url",
        "https://www.google.de");

    firefoxProfile.setPreference("browser.download.folderList", 2);
    firefoxProfile.setPreference(
        "browser.download.manager.showWhenStarting", false);
    String downloadDir = System.getProperty("java.io.tmpdir");
    firefoxProfile.setPreference("browser.download.dir", downloadDir);
    firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk",
        "text/csv,text/plain,application/zip,application/pdf");
    firefoxProfile.setPreference("browser.helperApps.alwaysAsk.force",
        false);
    System.out.println("Saving all attachments to: " + downloadDir);

    driver = new FirefoxDriver(firefoxProfile);
  }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.firefox.FirefoxProfile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.