Note that in this method you do not need to install each extension every time you create new Firefox driver.
WebDriver driver = new FirefoxDriver(firefoxOptions) ProfilesIni profilesIni = new ProfilesIni() įirefoxProfile profile = profilesIni.getProfile("M圜reatedProfile") įirefoxOptions firefoxOptions= new FirefoxOptions() This code should open Firefox with defined profile(Which the addons is installed on it) tProperty("", "c:/geckodriver.exe") The installed addon is now on your created profile. On Firefox window search the addons you want and install the addon, I searched for discard-tab and installed it. Now select your new created profile and click on Start Firefox button Click Create profile button on the opened windows and use wizard to create a new profile (In my case I created M圜reatedProfile) Hold down the Windows Key and Press R on your keyboard and write firefox.exe -pġ.2. You can use the default profile, but because of previous cashes and unnecessary addons, you'll maybe have 'Java Heap' error in first run. You should first create a Firefox profile and then embed it to selenium code. JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.Ĭonsole.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at C:\\Users\\ab\\AppData\\Local\\Temp\\rust_mozprofile.CSQe58I2OCxk\\4", (void 0)))ġ631259834207 Marionette INFO Listening on port 59932ġ631259834612 RemoteAgent WARN TLS certificate errors will be ignored for this sessionġ:13:54 PM .ProtocolHandshake createSession When I run the above code, the Firefox borwser opens, but the addon is not installed.ġ631259829322 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\ab\\AppData\\Local\\Temp\\rust_mozprofile.CSQe58I2OCxk"ġ631259830585 Marionette INFO Marionette enabled WebDriver firefoxDriver = new FirefoxDriver(firefoxOptions)
Profile.addExtension(new File("my_webext.xpi")) Java code: tProperty("", "geckodriver-v0.24.0-win64\\geckodriver.exe") įirefoxOptions firefoxOptions = new FirefoxOptions() įirefoxProfile profile = new FirefoxProfile() Note: If I install my addon(*.xpi file) manually to the firefox browser by using opiton "Install Add-on from File." option in settings, it installs correctly. have the addon installed when the firefox is launched. I would like to install my firefox addon using selenium and Java program i.e. I went through a number of posts but none of them could help me get it working.