-1
Good morning I am automating a website, and to run some features it is necessary to use an extension in the browser. First I was trying to add the extension to the web driver with the
FirefoxOptions options = new FirefoxOptions();
options.addPreference("extensions.webextensions.ExtensionStorageIDB.migrated.websigner@softplan.com.br", true);
Searching a little more, it seemed to me to be better to import a firefox profile when instantiating webDriver, I’m trying as follows
FirefoxOptions options = new FirefoxOptions();
FirefoxProfile firefoxProfile = new FirefoxProfile(
new File("/home/henrique/.mozilla/firefox/r6eis7qo.automacao"));
options.setProfile(firefoxProfile);
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "/home/files/logsGeckodriver.txt");
WebDriver driver = new FirefoxDriver(options);
but the webDriver is not instantiated, nor does it point to any error,
when adding options.setCapability("marionette", false);
it instantiates the webDriver, but without the desired profile
the "automation" profile is customized with the extension and the following preferences
options.addPreference("browser.download.folderList", 2);
options.addPreference("browser.download.dir", paramDownload);
options.addPreference("browser.download.useDownloadDir", true);
options.addPreference("browser.helperApps.neverAsk.saveToDisk",
"application/pdf," + "text/plain," + "application/octet-stream," + "application/x-pdf,"
+ "application/vnd.pdf," + "application/vnd.openxmlformats-officedocument.spreadsheethtml,"
+ "text/csv," + "text/html," + "application/x-msexcel," + "application/excel,"
+ "application/x-excel," + "application/vnd.ms-excel");
options.addPreference("pdfjs.disabled", true);
when inspecting the code he finds the profile
new FirefoxProfile(
new File("/home/henrique/.mozilla/firefox/r6eis7qo.automacao"));
and in firefox when switching between profiles and check the settings are correct
I asked this question on stackoverflow.with, she ended up being marked as duplicate, but the answers aren’t working for me. I’m using Selenium 3.141.59, Firefox 70.0 and geckodriver v0.24.0
If the profile generated by Geckodriver or Chromedriver is another then it makes no sense to take the existing uuid, because the profile is different from the one you use default on your OS user, you would have to install the add-on when starting the Driver using
options.add_extension()
or you can create a separate profile and load as something like thisFirefoxProfile('/caminho/pasta/.mozilla/firefox/pastadoperfil')
and will have access to an already configured profile that you can adjust and leave it all as you wish.– Guilherme Nascimento
thanks for the reply, and how do I set up a profile? had already searched the web for it, but without success.
– Henrique Lemes Baron
I’m running out of time now and using the comment field is tricky, but the night vote to reopen your question and answer in the appropriate field for answers how to do step by step.
– Guilherme Nascimento