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

Function getAvailableBrowsers

javascript/selenium-webdriver/testing/index.js:131–163  ·  view source on GitHub ↗

* @return {!Array<!TargetBrowser>} the browsers available for testing on this * system.

()

Source from the content-addressed store, hash-verified

129 * system.
130 */
131function getAvailableBrowsers() {
132 info(`Searching for WebDriver executables installed on the current system...`)
133
134 let targets = [
135 [getBinaryPaths(new chrome.Options()), Browser.CHROME],
136 [getBinaryPaths(new edge.Options()), Browser.EDGE],
137 [getBinaryPaths(new firefox.Options()), Browser.FIREFOX],
138 ]
139 if (process.platform === 'win32') {
140 targets.push([getBinaryPaths(new ie.Options()), Browser.INTERNET_EXPLORER])
141 }
142 if (process.platform === 'darwin') {
143 targets.push([getBinaryPaths(new safari.Options()), Browser.SAFARI])
144 }
145
146 let availableBrowsers = []
147 for (let pair of targets) {
148 const driverPath = pair[0].driverPath
149 const browserPath = pair[0].browserPath
150 const name = pair[1]
151 const capabilities = pair[2]
152 if (driverPath.length > 0 && browserPath && browserPath.length > 0) {
153 info(`... located ${name}`)
154 availableBrowsers.push({ name, capabilities })
155 }
156 }
157
158 if (availableBrowsers.length === 0) {
159 warn(`Unable to locate any WebDriver executables for testing`)
160 }
161
162 return availableBrowsers
163}
164
165let wasInit
166let targetBrowsers

Callers 1

initFunction · 0.85

Calls 3

infoFunction · 0.85
getBinaryPathsFunction · 0.85
warnFunction · 0.85

Tested by

no test coverage detected