I’m trying to use a custom profile in Firefox with an add-on, I can open the profile, launch URL, I even see the add-on icon on top bar but is always set into the disabled mode, I need to set it to active all time. The add-on is ‘anonymous’
below is what I did, but no success.
public class SeleniumScript {
static WebDriver driver;
public static void main(String args[]) throws Exception {
System.setProperty(“webdriver.gecko.driver”, “E:\Library\geckodriver-v0.21.0-win32\geckodriver.exe”);
ProfilesIni profile2 = new ProfilesIni();
FirefoxProfile profile3 = profile2.getProfile(“AutoProfile”);
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(profile3);
File file = new File(“C:\Users\xxx\AppData\Roaming\Mozilla\Firefox\Profiles\vjo848oc.AutoProfile\extensions\client@anonymox.net.xpi”);
profile3.addExtension(file);
profile3.setPreference(“extensions.anonymox.currentVersion”, “4.1”);
driver = new FirefoxDriver(firefoxOptions);
String baseURL = “http://abc.com”;
driver.get(baseURL);
driver.manage().window().maximize();
}
}
Source: Read More