MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / installWebExtension

Method installWebExtension

javascript/selenium-webdriver/firefox.js:616–637  ·  view source on GitHub ↗

* Installs a browser extension. Works with remote (Grid) sessions. Uses BiDi when the session * has it enabled, and otherwise falls back to geckodriver's classic addon endpoint. * * Pass `permanent: false` to install an unsigned extension; without the option, each transport * applies its

(extension, options = undefined)

Source from the content-addressed store, hash-verified

614 * @override
615 */
616 async installWebExtension(extension, options = undefined) {
617 options = webExtension.checkInstallOptions(options, ['permanent', 'allowPrivateBrowsing'], 'Firefox')
618 const { permanent, allowPrivateBrowsing } = options
619
620 if (!(await webExtension.isBidiEnabled(this))) {
621 const cmd = new command.Command(ExtensionCommand.INSTALL_ADDON).setParameter(
622 'addon',
623 await webExtension.encodeExtension(extension),
624 )
625 if (permanent !== undefined) cmd.setParameter('temporary', !permanent)
626 if (allowPrivateBrowsing !== undefined) cmd.setParameter('allowPrivateBrowsing', allowPrivateBrowsing)
627 return new webExtension.WebExtension(await this.execute(cmd))
628 }
629
630 const { MozWebExtension } = require('./bidi/generated/webextension')
631 const module = await MozWebExtension.create(this)
632 const result = await module.install({
633 extensionData: await webExtension.extensionData(this, extension),
634 ...options,
635 })
636 return new webExtension.WebExtension(result.extension)
637 }
638
639 /**
640 * Uninstalls a browser extension installed with {@link #installWebExtension}. Uses BiDi when

Callers

nothing calls this directly

Calls 4

setParameterMethod · 0.80
executeMethod · 0.65
createMethod · 0.65
installMethod · 0.45

Tested by

no test coverage detected