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

Function getAvailableBrowsers

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

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

()

Source from the content-addressed store, hash-verified

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

Callers 1

initFunction · 0.85

Calls 3

infoFunction · 0.85
getBinaryPathsFunction · 0.85
warnFunction · 0.85

Tested by

no test coverage detected