MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / buildProfile

Function buildProfile

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

* @param {?string} template path to an existing profile to use as a template. * @param {!Array } extensions paths to extensions to install in the new * profile. * @return {!Promise } a promise for the base64 encoded profile.

(template, extensions)

Source from the content-addressed store, hash-verified

213 * @return {!Promise<string>} a promise for the base64 encoded profile.
214 */
215async function buildProfile(template, extensions) {
216 let dir = template
217
218 if (extensions.length) {
219 dir = await io.tmpDir()
220 if (template) {
221 await io.copyDir(/** @type {string} */ (template), dir, /(parent\.lock|lock|\.parentlock)/)
222 }
223
224 const extensionsDir = path.join(dir, 'extensions')
225 await io.mkdir(extensionsDir)
226
227 for (let i = 0; i < extensions.length; i++) {
228 await installExtension(extensions[i], extensionsDir)
229 }
230 }
231
232 let zip = new Zip()
233 return zip
234 .addDir(dir)
235 .then(() => zip.toBuffer())
236 .then((buf) => buf.toString('base64'))
237}
238
239/**
240 * Configuration options for the FirefoxDriver.

Callers 1

[Symbols.serialize]Method · 0.85

Calls 6

addDirMethod · 0.95
toBufferMethod · 0.95
installExtensionFunction · 0.85
copyDirMethod · 0.80
joinMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected