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

Method installAddon

javascript/selenium-webdriver/firefox.js:560–579  ·  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

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