Below code didn't changed FF profile when I am having 3(randomly created nos.) custom FF profiles and 1 default.
WebDriver driver;
String profilepath = "<user Dir>/Local/Mozilla/Firefox/Profiles/";
ProfilesIni profilesini = new ProfilesIni();
FirefoxProfile firefoxprofile = new FirefoxProfile(new File(profilepath));
firefoxprofile = profilesini.getProfile("profile_1");
driver = new FirefoxDriver(firefoxprofile);
FF profiles are : profile_1, profile_2 and profile_3. When I run the code FF launched with either 'profile_2 or default'. Not with passed profile name (profile_1)
Am using selenium-sever standalone 2.53.0 and FF 46.0 on Win 10, 64 bit.
If you want to launch a custom firefox profile. This is how you do it.
First you create an object of ProfilesIni
then you get the desired firefox profile
using getProfile()
and then that particular profile is passed to WebDriver
initialization.
ProfilesIni profiles = new ProfilesIni();
FirefoxProfile profile = profiles.getProfile("profile_1");
WebDriver driver = new FirefoxDriver(profile);
Hope it helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.