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

Method installAddon

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

* Installs a new addon with the current session. This function will return an * ID that may later be used to plain #uninstallAddon uninstall the * addon. * * * @param {string} path Path on the local filesystem to the web extension to * install. * @param {boolean} temp

(path, temporary = false)

Source from the content-addressed store, hash-verified

559 * @deprecated Use {@link #installWebExtension} instead.
560 */
561 async installAddon(path, temporary = false) {
562 webdriver.WebDriver.logger.deprecate(
563 'firefox-installAddon',
564 'firefox.Driver#installAddon() is deprecated. Use driver.installWebExtension() instead.',
565 )
566 let stats = fs.statSync(path)
567 let buf
568 if (stats.isDirectory()) {
569 let zip = new Zip()
570 await zip.addDir(path)
571 buf = await zip.toBuffer('DEFLATE')
572 } else {
573 buf = await io.read(path)
574 }
575 return this.execute(
576 new command.Command(ExtensionCommand.INSTALL_ADDON)
577 .setParameter('addon', buf.toString('base64'))
578 .setParameter('temporary', temporary),
579 )
580 }
581
582 /**
583 * Uninstalls an addon from the current browser session's profile.

Callers 1

addon_test.jsFile · 0.80

Calls 8

addDirMethod · 0.95
toBufferMethod · 0.95
setParameterMethod · 0.80
isDirectoryMethod · 0.65
readMethod · 0.65
executeMethod · 0.65
toStringMethod · 0.65
deprecateMethod · 0.45

Tested by

no test coverage detected