The Firefox binary lets you run tests on your favorite Firefox versions. In order to do that, perform the following steps:
import java.io.File; import org.openqa.selenium.firefox.FirefoxBinary; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile;
FirefoxBinary binary = new FirefoxBinary(new File("C://Program Files//Mozilla Firefox26//firefox.exe"));
FirefoxProfile profile = new FirefoxProfile();
WebDriver driver = new FirefoxDriver(binary, profile);
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary driver = webdriver.Firefox (firefox_binary=FirefoxBinary("C://Program Files//Mozilla Firefox26//firefox.exe"))
In general, custom profiles are used in order to get rid of control over existing cookies that contain history, bookmarks, passwords, personal information, and so on.
Firefox Profile Manager is used to create or remove Firefox profiles. To create a Firefox profile, perform the following steps:
firefox.exe –p
and click on OK.myProjectProfile
) by clicking on the Create Profile button from the profile manager.ProfilesIni profile = new ProfilesIni();
FirefoxProfilemyprofile = profile.getProfile("myProjectProfile");
WebDriver driver = new FirefoxDriver(myprofile);
In Linux, Firefox native events are disabled by default as they may launch more than one browser in parallel in a test. To enable such default Firefox-disabled features, the native events insist on being set to true
, as shown in the following code:
FirefoxProfile profile = new FirefoxProfile(); profile.setEnableNativeEvents(true); WebDriver driver = new FirefoxDriver(profile);