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);
File pathToBinary = new File("C:\\Program Files\\Mozilla Firefox15\\Firefox.exe"); FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary); FirefoxProfile firefoxProfile = new FirefoxProfile(); FirefoxDriver _driver = new FirefoxDriver(ffBinary,firefoxProfile);
FirefoxBinary firefox = new FirefoxBinary(); firefox.setEnvironmentProperty("DISPLAY", ":" + DISPLAY_NUMBER); WebDriver driver = new FirefoxDriver(firefox, null);
WebDriver driver = new FirefoxDriver(new FirefoxBinary(new File("path/to/your/firefox.exe")), profile);
FirefoxBinary binary = new FirefoxBinary(new File("path/to/binary")); FirefoxProfile profile = new FirefoxProfile(); WebDriver driver = new FirefoxDriver(binary, profile);
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(); }
/** * Get the FirefoxBinary to use. Exists to allow subclasses to override. * * @return the default Firefox binary. */ public FirefoxBinary getFirefoxBinary() { return new FirefoxBinary(); }
@Override public boolean isAvailable() { try { // This will search $PATH looking for the binary. It's not perfect, since the user may be // setting the path to the binary with a capability, but this will work in almost all common // cases. new FirefoxBinary(); return true; } catch (IllegalStateException | WebDriverException e) { return false; } }
private WebDriver driver = null; public void openHeadless() throws Exception { FirefoxBinary binary = new FirefoxBinary(new File("/usr/local/bin/firefox")); binary.setEnvironmentProperty("DISPLAY",System.getProperty("lmportal.xvfb.id",":99")); driver = new FirefoxDriver(binary,null); }
File pathBinary = new File("C:\\program files\\Mozilla Firefox\\firefox.exe"); FirefoxBinary firefoxBinary = new FirefoxBinary(pathBinary); FirefoxProfile firefoxProfile = new FirefoxProfile(); WebDriver driver = new FirefoxDriver(firefoxBinary, firefoxProfile);
String torPath = "/Volumes/DATA/Downloads/Tor.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/firefox"; String profilePath = "/Users/mimitantono/Library/Application Support/Firefox/Profiles/1vps9kas.default-1384778906995"; FirefoxProfile profile = new FirefoxProfile(new File(profilePath)); FirefoxBinary binary = new FirefoxBinary(new File(torPath)); FirefoxDriver driver = new FirefoxDriver(binary, profile); driver.get("http://www.google.com/webhp?complete=1&hl=en");
FirefoxBinary bin = new FirefoxBinary( new File(System.getProperty("user.dir"), "/tools/FirefoxPortable/FirefoxPortable.exe")); DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(FirefoxDriver.BINARY, bin); WebDriver driver = new RemoteWebDriver(capabilities); driver.get("http://google.com");
if(browser == SupportedBrowser.FIREFOX) { File pathToBinary = new File("path/to/firefox.exe"); FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary); FirefoxProfile firefoxProfile = new FirefoxProfile(); FirefoxDriver _driver = new FirefoxDriver(ffBinary,firefoxProfile); return _driver; }
File ffpath = new File("path/to/firefox.exe"); FirefoxBinary ffbinary = new FirefoxBinary(ffpath); FirefoxProfile ffprofile = new FirefoxProfile(); driver = new FirefoxDriver(ffbinary,ffprofile);
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);
@Override protected File findDefaultExecutable() { if (binary == null) { return new FirefoxBinary().getFile(); } return binary.getFile(); }
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);
@Override public WebDriver create(Capabilities capabilities, Properties properties) { final File firefoxPath = new File(properties.getProperty(ConfigKeys.WEBDRIVER_FIREFOX_BIN)); FirefoxBinary firefoxBinary = new FirefoxBinary(firefoxPath); firefoxBinary.setEnvironmentProperty("DISPLAY", properties.getProperty(ConfigKeys.WEBDRIVER_XVFB_ID)); FirefoxOptions firefoxOptions = new FirefoxOptions(capabilities).setBinary(firefoxBinary); return new FirefoxDriver(firefoxOptions); } };
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; }
FirefoxDriver firefoxDriver; File torProfileDir = new File("C:\\tor\\Tor Browser\\Browser\\TorBrowser\\Data\\Browser\\profile.default"); FirefoxBinary binary = new FirefoxBinary(new File( "C:\\tor\\Tor Browser\\Browser\\firefox.exe"));//C:\tor\Tor Browser\Browser FirefoxProfile torProfile = new FirefoxProfile(torProfileDir); torProfile.setPreference("webdriver.load.strategy", "unstable"); binary.startProfile(torProfile, torProfileDir); 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);