MCPcopy
hub / github.com/SeleniumHQ/selenium / builder

Method builder

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

* @return {!Builder} a new WebDriver builder configured to target this * environment's plain #browser browser.

()

Source from the content-addressed store, hash-verified

294 * environment's {@linkplain #browser browser}.
295 */
296 builder() {
297 const browser = this.browser
298 const urlOrServer = URL_MAP.get(this)
299
300 const builder = new Builder()
301
302 // Sniff the environment variables for paths to use for the common browsers
303 // Chrome
304 if ('SE_CHROMEDRIVER' in process.env) {
305 const found = locate(process.env.SE_CHROMEDRIVER)
306 const service = new chrome.ServiceBuilder(found)
307 builder.setChromeService(service)
308 }
309 if ('SE_CHROME' in process.env) {
310 const binary = locate(process.env.SE_CHROME)
311 const options = new chrome.Options()
312 options.setChromeBinaryPath(binary)
313 options.setAcceptInsecureCerts(true)
314 options.addArguments('disable-infobars', 'disable-breakpad', 'disable-dev-shm-usage', 'no-sandbox')
315 builder.setChromeOptions(options)
316 }
317 // Edge
318 // Firefox
319 if ('SE_GECKODRIVER' in process.env) {
320 const found = locate(process.env.SE_GECKODRIVER)
321 const service = new firefox.ServiceBuilder(found)
322 builder.setFirefoxService(service)
323 }
324 if ('SE_FIREFOX' in process.env) {
325 const binary = locate(process.env.SE_FIREFOX)
326 const options = new firefox.Options()
327 options.enableBidi()
328 options.setBinary(binary)
329 builder.setFirefoxOptions(options)
330 }
331
332 builder.disableEnvironmentOverrides()
333
334 const realBuild = builder.build
335 builder.build = function () {
336 builder.forBrowser(browser.name, browser.version, browser.platform)
337
338 if (browser.capabilities) {
339 builder.getCapabilities().merge(browser.capabilities)
340 }
341
342 if (browser.name === 'firefox') {
343 builder.setCapability('moz:debuggerAddress', true)
344 }
345
346 // Enable BiDi for supporting browsers.
347 if (browser.name === Browser.FIREFOX || browser.name === Browser.CHROME || browser.name === Browser.EDGE) {
348 builder.setCapability('webSocketUrl', true)
349 builder.setCapability('unhandledPromptBehavior', 'ignore')
350 }
351
352 if (typeof urlOrServer === 'string') {
353 builder.usingServer(urlOrServer)

Callers 15

window_test.jsFile · 0.45
createDriverFunction · 0.45
GetBrowserForTestsFunction · 0.45
logging_test.jsFile · 0.45
cookie_test.jsFile · 0.45

Calls 15

setChromeServiceMethod · 0.95
setChromeBinaryPathMethod · 0.95
addArgumentsMethod · 0.95
setChromeOptionsMethod · 0.95
setFirefoxServiceMethod · 0.95
enableBidiMethod · 0.95
setBinaryMethod · 0.95
setFirefoxOptionsMethod · 0.95
forBrowserMethod · 0.95
getCapabilitiesMethod · 0.95
setCapabilityMethod · 0.95

Tested by

no test coverage detected