Edit: 2020-06-11 – ⚠️ This initial comment is not correct. I misunderstood the GeckoDriver API. I was looking at stale source code. 😓 With new knowledge and some guidance from the GeckoDriver team, I've proposed an approach to handle the "install addon" command from FirefoxDriver consistently for each language. See my long comment below.
--
🐛 Bug Report
We can't install a temporary extension in Firefox using the JavaScript or DotNet bindings. The implementation is inconsistent across the languages. The GeckoDriver API expects a path as a String but we're sending an addon. See mozilla/geckodriver - marionette.rs.
These two bindings need to be fixed:
These seem to be OK:
To Reproduce
Try to install an extension without building an .xpi or .zip file using dotnet and javascript bindings.
TODO - Script
Expected behavior
I expect to be able to install a temporary extension in Firefox:
- From the JavaScript library using
installAddon
- From the DotNet library using
InstallAddOn
- Note 1: This method is not in those docs?!
- Note 2:
InstallAddOnFromFile is also made redundant
Test script or set of commands reproducing this issue
TODO - Include in example repo.
The steps to reproduce are:
- Create a minimal extension
- extension\manifest.json
{
"name": "Uh oh!",
"description" : "Print a message to the console you may not see",
"version": "0.1",
"manifest_version": 2,
"content_scripts": [
{
"matches": ["https://*.github.com/*"],
"js": ["index.js"]
}
]
}
- extension\index.js
console.log('We did it! ⭐️');
- Start Firefox and add an extension
- javascript/example.js
const { Builder, By } = require('selenium-webdriver');
const { Options } = require('selenium-webdriver/firefox');
(async () => {
const options =
new Options()
.setPreference('extensions.htmlaboutaddons.recommendations.enabled', false);
const builder =
new Builder()
.forBrowser('firefox')
.setFirefoxOptions(options);
const driver = builder.build();
const isTemporaryAddon = true;
driver.installAddon('../extension/', isTemporaryAddon);
await driver.get('https://github.com/SeleniumHQ/selenium');
// Expected: A message to be printed on the console
// Expected: The temporary extension appears in about:debugging > This Firefox > Temporary Extensions
})();
- Install selenium-webdriver
echo {} > package.json
npm install --save-dev selenium-webdriver
- Run
node javascript/example.js
Environment
OS: macOS
Browser: Firefox
Browser version: 71.0
Browser Driver version: GeckoDriver for the last 2+ years
Language Bindings version: Latest
Selenium Grid version (if applicable): Not applicable
Questions
- Would you welcome a PR?
- Do you want the issue or PR split by language?
Edit: 2020-06-11 –⚠️ This initial comment is not correct. I misunderstood the GeckoDriver API. I was looking at stale source code. 😓 With new knowledge and some guidance from the GeckoDriver team, I've proposed an approach to handle the "install addon" command from FirefoxDriver consistently for each language. See my long comment below.
--
🐛 Bug Report
We can't install a temporary extension in Firefox using the JavaScript or DotNet bindings. The implementation is inconsistent across the languages. The GeckoDriver API expects a
pathas a String but we're sending anaddon. See mozilla/geckodriver - marionette.rs.These two bindings need to be fixed:
These seem to be OK:
To Reproduce
Try to install an extension without building an .xpi or .zip file using dotnet and javascript bindings.
TODO - Script
Expected behavior
I expect to be able to install a temporary extension in Firefox:
installAddonInstallAddOnInstallAddOnFromFileis also made redundantTest script or set of commands reproducing this issue
TODO - Include in example repo.
The steps to reproduce are:
{ "name": "Uh oh!", "description" : "Print a message to the console you may not see", "version": "0.1", "manifest_version": 2, "content_scripts": [ { "matches": ["https://*.github.com/*"], "js": ["index.js"] } ] }Environment
OS: macOS
Browser: Firefox
Browser version: 71.0
Browser Driver version: GeckoDriver for the last 2+ years
Language Bindings version: Latest
Selenium Grid version (if applicable): Not applicable
Questions