Selenium: Add support for GeckoDriver addons command

Created on 23 Jun 2017  路  9Comments  路  Source: SeleniumHQ/selenium

Browser: Firefox

Recently geckodriver added support for installing webextensions. I was able to get things working with this code:

def install_ext_on_ff(driver, extension_path):
    command = 'addonInstall'
    driver.command_executor._commands[command] = ('POST', '/session/$sessionId/moz/addon/install')
    driver.execute(command, params={'path': extension_path, 'temporary': True})
    time.sleep(2)
D-marionette

Most helpful comment

@jleyba would you mind adding the temporary parameter too, please? This would be very useful for WebExtension testing.

  async installAddon(path, temporary=false) {
...
        new command.Command(ExtensionCommand.INSTALL_ADDON)
            .setParameter('addon', buf.toString('base64'))
            .setParameter('temporary', temporary));

All 9 comments

Are you interested in submitting a pull request? You could base it on the context command, which is also only currently available for Firefox. See https://github.com/SeleniumHQ/selenium/commit/41090666a4e38644a61161beb53dd574d79c3225 for where that was introduced.

As far as I can see, this command is not supported in any of bindings, so needs to be added.

@davehunt I won't have much time to work on this in the near future.

Link to the geckodriver release notes here https://github.com/mozilla/geckodriver/releases/tag/v0.17.0

I made it work for Ruby and Python bindings, but I don't know how to properly do that for JavaScript, Java and .NET.

See 26fa936172bca06a5d3c56b3814536e39e48b82c for details.

It is not yet possible to send the install/uninstall request through Selenium grid to Geckodriver?

@jleyba would you mind adding the temporary parameter too, please? This would be very useful for WebExtension testing.

  async installAddon(path, temporary=false) {
...
        new command.Command(ExtensionCommand.INSTALL_ADDON)
            .setParameter('addon', buf.toString('base64'))
            .setParameter('temporary', temporary));

Looks like all bindings have this so closing

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings