Refine search
File pathToBinary = new File("C:\\user\\Programme\\FirefoxPortable\\App\\Firefox\\firefox.exe"); FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary); FirefoxProfile firefoxProfile = new FirefoxProfile(); WebDriver driver = new FirefoxDriver(ffBinary,firefoxProfile);
FirefoxBinary firefox = new FirefoxBinary(); firefox.setEnvironmentProperty("DISPLAY", ":" + DISPLAY_NUMBER); WebDriver driver = new FirefoxDriver(firefox, null); driver.get(URL);
File torProfileDir = new File( "...\\Tor Browser\\Data\\Browser\\profile.default"); FirefoxBinary binary = new FirefoxBinary(new File( "...\\Tor Browser\\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(); }
FirefoxBinary firefox = new FirefoxBinary(new File("/path/to/firefox.exe")); FirefoxProfile customProfile = new FirefoxProfile(); customProfile.setAcceptUntrustedCertificates(true); customProfile.setPreference("network.http.connection-timeout", 10); customProfile.setPreference("network.http.connection-retry-timeout", 10); driver = new FirefoxDriver(firefox, customProfile); driver.manage().deleteAllCookies();
FirefoxBinary firefox = new FirefoxBinary(new File("/path/to/firefox.exe")); FirefoxProfile customProfile = new FirefoxProfile(); customProfile.setPreference("network.http.connection-timeout", 10); customProfile.setPreference("network.http.connection-retry-timeout", 10); driver = new FirefoxDriver(firefox, customProfile);
() -> FirefoxProfile.fromJson((String) caps.getCapability(FirefoxDriver.PROFILE)), () -> ((FirefoxOptions) caps).getProfile(), () -> (FirefoxProfile) ((Map<String, Object>) caps.getCapability(FIREFOX_OPTIONS)).get("profile"), () -> FirefoxProfile.fromJson((String) ((Map<String, Object>) caps.getCapability(FIREFOX_OPTIONS)).get("profile")), () -> { Map<String, Object> options = (Map<String, Object>) caps.getCapability(FIREFOX_OPTIONS); FirefoxProfile toReturn = new FirefoxProfile(); ((Map<String, Object>) options.get("prefs")).forEach((key, value) -> { if (value instanceof Boolean) { toReturn.setPreference(key, (Boolean) value); } actualBinary = (FirefoxBinary) binary; } else if (binary instanceof String) { actualBinary = new FirefoxBinary(new File(String.valueOf(binary))); } else { throw new IllegalArgumentException(
FirefoxBinary binary = new FirefoxBinary(); File firefoxProfileFolder = new File("/Users/xxx/work/xxx/selenium/src/test/resources/firefoxprofile"); FirefoxProfile profile = new FirefoxProfile(firefoxProfileFolder); profile.setAcceptUntrustedCertificates(true); webDriver = new FirefoxDriver(binary, profile);
FirefoxProfile profile = new FirefoxProfile(); FirefoxBinary binary = new FirefoxBinary(); binary.StartProfile(profile, "-safe-mode");
FirefoxProfile ffProfile = new FirefoxProfile(); FirefoxBinary ffBinary = new FirefoxBinary(); ffBinary.setTimeout(TimeUnit.SECONDS.toMillis(180)); driver = new FirefoxDriver(ffBinary, ffProfile);
FirefoxBinary binary = new FirefoxBinary(new File("path_to_firefox")); FirefoxProfile ffprofile = profile.getProfile("1"); ffprofile.setPreference("browser.privatebrowsing.autostart", true); WebDriver driver = new FirefoxDriver(binary, ffprofile);
WebDriver driver = new FirefoxDriver(new FirefoxBinary(new File("path/to/your/firefox.exe")), profile);
public void initialize() { String profileName = System.getProperty(FIREFOX_PROFILE); final FirefoxBinary binary = new FirefoxBinary(); decorateFirefoxBinary(binary); OverriddenFirefoxDriver firefoxDriver = null; if (profileName != null) { ProfilesIni allProfilesIni = new ProfilesIni(); FirefoxProfile profile = allProfilesIni.getProfile(profileName); profile.setAcceptUntrustedCertificates(false); firefoxDriver = new OverriddenFirefoxDriver(binary, profile); delegate.set(firefoxDriver); } else { firefoxDriver = null; final WebDriver[] fireFoxDriverz = new WebDriver[1]; firefoxDriver = new DoublyOverriddenFirefoxDriver(binary, fireFoxDriverz); fireFoxDriverz[0] = firefoxDriver; delegate.set(firefoxDriver); if(driverToThreadMap.containsKey(System.identityHashCode(firefoxDriver))){ // TODO - take out all this driverToThreadMap // For debugging during development // throw new Error("Duplicate Driver !!!!!!!"); }else{ driverToThreadMap.put(System.identityHashCode(firefoxDriver),Thread.currentThread().getId()); } } firefoxDriver.setCommandExecutor(new OverridableCommandExecutor(firefoxDriver.getCommandExecutor())); }
public FirefoxBinary startProfile(FirefoxProfile profile, int port) throws IOException { FirefoxBinary binaryToUse = binary; if (binary == null) { binaryToUse = new FirefoxBinary(); } FirefoxProfile profileToUse = profile.createCopy(port); binaryToUse.clean(profileToUse); binaryToUse.startProfile(profileToUse); return binaryToUse; }
@Override protected File findDefaultExecutable() { if (binary == null) { return new FirefoxBinary().getFile(); } return binary.getFile(); }
/** * This method creates a new {@link FirefoxDriver}. * * @param proxyUrl : the proxy url * @param downloadPath : the location where all the files should be downloaded. * @param fileType : all the types that can be downloaded automatically. * @return {@link WebDriver} */ protected static WebDriver createFireFoxDriver(String proxyUrl, String downloadPath, String fileType) { FirefoxDriver firefoxDriver = null; FirefoxBinary binary = new FirefoxBinary(); FirefoxProfile profile = createFirefoxProfile(fileType, downloadPath); try { firefoxDriver = new FirefoxDriver(binary, profile, createCapabilitesFirefox(proxyUrl, profile)); } catch (WebDriverException e) { /* * This is a bug in Selenium. When an exception is thrown when selenium tries to create to create a driver, than their is * already a Firefox window open. This window needs to be closed. */ binary.quit(); // throw the exception again throw e; } // This sets the proxy optionally return firefoxDriver; } protected static FirefoxProfile createFirefoxProfile(String fileType, String downloadPath) {
FirefoxBinary ffox = new FirefoxBinary(firefoxPath); ffox.setEnvironmentProperty("DISPLAY", ":20"); driver = new FirefoxDriver(ffox, null);
public void clean(FirefoxProfile profile) throws IOException { startProfile(profile, "-silent"); try { waitFor(); } catch (InterruptedException e) { throw new WebDriverException(e); } if (Platform.getCurrent().is(Platform.WINDOWS)) { while (profile.isRunning()) { sleep(500); } do { sleep(500); } while (profile.isRunning()); } }
public void startProfile(FirefoxProfile profile, String... commandLineFlags) throws IOException { setEnvironmentProperty("XRE_PROFILE_PATH", profile.getProfileDir().getAbsolutePath()); setEnvironmentProperty("MOZ_NO_REMOTE", "1"); List<String> commands = new ArrayList<String>(); commands.add(executable.getPath()); commands.add("--verbose"); commands.addAll(Arrays.asList(commandLineFlags)); ProcessBuilder builder = new ProcessBuilder(commands); builder.redirectErrorStream(); builder.environment().putAll(extraEnv); executable.setLibraryPath(builder, extraEnv); process = builder.start(); }
/** * Get the FirefoxBinary to use. Exists to allow subclasses to override. * * @return the default Firefox binary. */ public FirefoxBinary getFirefoxBinary() { return new FirefoxBinary(); }
@Override protected void decorateFirefoxBinary(FirefoxBinary binary) { super.decorateFirefoxBinary(binary); String displayID = displayIdPool.get(); displayScreenId.set(displayID); binary.setEnvironmentProperty("DISPLAY", displayID); System.out.println(new StringBuffer("Displays used=").append(++refCt).toString()); }