MCPcopy
hub / github.com/SeleniumHQ/selenium / installAddon

Method installAddon

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

652 * @see #uninstallAddon
653 */
654 async installAddon(path, temporary = false) {
655 let stats = fs.statSync(path)
656 let buf
657 if (stats.isDirectory()) {
658 let zip = new Zip()
659 await zip.addDir(path)
660 buf = await zip.toBuffer('DEFLATE')
661 } else {
662 buf = await io.read(path)
663 }
664 return this.execute(
665 new command.Command(ExtensionCommand.INSTALL_ADDON)
666 .setParameter('addon', buf.toString('base64'))
667 .setParameter('temporary', temporary),
668 )
669 }
670
671 /**
672 * Uninstalls an addon from the current browser session's profile.

Callers 1

addon_test.jsFile · 0.80

Calls 7

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

Tested by

no test coverage detected