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

Function binaryPaths

javascript/selenium-webdriver/common/seleniumManager.js:70–101  ·  view source on GitHub ↗

* Determines the path of the correct driver * @param {string[]} args arguments to invoke Selenium Manager * @returns {{browserPath: string, driverPath: string}} path of the driver and * browser location

(args)

Source from the content-addressed store, hash-verified

68 */
69
70function binaryPaths(args) {
71 const smBinary = getBinary()
72 const spawnResult = spawnSync(smBinary, args)
73 let output
74 if (spawnResult.status) {
75 let errorMessage
76 if (spawnResult.stderr.toString()) {
77 errorMessage = spawnResult.stderr.toString()
78 }
79 if (spawnResult.stdout.toString()) {
80 try {
81 output = JSON.parse(spawnResult.stdout.toString())
82 logOutput(output)
83 errorMessage = output.result.message
84 } catch (e) {
85 errorMessage = e.toString()
86 }
87 }
88 throw new Error(`Error executing command for ${smBinary} with ${args}: ${errorMessage}`)
89 }
90 try {
91 output = JSON.parse(spawnResult.stdout.toString())
92 } catch (e) {
93 throw new Error(`Error executing command for ${smBinary} with ${args}: ${e.toString()}`, { cause: e })
94 }
95
96 logOutput(output)
97 return {
98 driverPath: output.result.driver_path,
99 browserPath: output.result.browser_path,
100 }
101}
102
103function logOutput(output) {
104 for (const key in output.logs) {

Callers 1

getBinaryPathsFunction · 0.85

Calls 4

getBinaryFunction · 0.85
logOutputFunction · 0.85
toStringMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected