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

Function extensionData

javascript/selenium-webdriver/lib/web_extension.js:139–148  ·  view source on GitHub ↗

* The BiDi `webExtension.ExtensionData` for `extension`. A directory only resolves on the * machine running the browser, so unless the session runs on a driver service this client * started (see Symbols.localDriverService) it is uploaded first; an archive or base64 * bytes travel inline.

(driver, extension)

Source from the content-addressed store, hash-verified

137 * @return {!Promise<import('../bidi/generated/webextension').WebExtensionExtensionData>}
138 */
139async function extensionData(driver, extension) {
140 checkExtensionArg(extension)
141 const stats = await statOrNull(extension)
142 if (stats?.isDirectory()) {
143 const dir = path.resolve(extension)
144 const local = driver.getExecutor()[Symbols.localDriverService] === true
145 return { type: 'path', path: local ? dir : await uploadDirectory(driver, dir) }
146 }
147 return { type: 'base64', value: await encodeExtension(extension) }
148}
149
150/**
151 * Uploads `dir` to the remote end and returns the path it was unpacked to there.

Callers 1

Calls 7

checkExtensionArgFunction · 0.85
statOrNullFunction · 0.85
uploadDirectoryFunction · 0.85
encodeExtensionFunction · 0.85
isDirectoryMethod · 0.65
resolveMethod · 0.45
getExecutorMethod · 0.45

Tested by

no test coverage detected