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

Function createServiceFromCapabilities

javascript/selenium-webdriver/ie.js:379–416  ·  view source on GitHub ↗
(capabilities)

Source from the content-addressed store, hash-verified

377}
378
379function createServiceFromCapabilities(capabilities) {
380 if (process.platform !== 'win32') {
381 throw Error(
382 'The IEDriver may only be used on Windows, but you appear to be on ' +
383 process.platform +
384 '. Did you mean to run against a remote ' +
385 'WebDriver server?',
386 )
387 }
388
389 let exe = null // Let Selenium Manager find it
390 var args = []
391 if (capabilities.has(Key.HOST)) {
392 args.push('--host=' + capabilities.get(Key.HOST))
393 }
394 if (capabilities.has(Key.LOG_FILE)) {
395 args.push('--log-file=' + capabilities.get(Key.LOG_FILE))
396 }
397 if (capabilities.has(Key.LOG_LEVEL)) {
398 args.push('--log-level=' + capabilities.get(Key.LOG_LEVEL))
399 }
400 if (capabilities.has(Key.EXTRACT_PATH)) {
401 args.push('--extract-path=' + capabilities.get(Key.EXTRACT_PATH))
402 }
403 if (capabilities.get(Key.SILENT)) {
404 args.push('--silent')
405 }
406
407 var port = portprober.findFreePort()
408 return new remote.DriverService(exe, {
409 loopback: true,
410 port: port,
411 args: port.then(function (port) {
412 return args.concat('--port=' + port)
413 }),
414 stdio: 'ignore',
415 })
416}
417
418/**
419 * Creates {@link selenium-webdriver/remote.DriverService} instances that manage

Callers 1

createSessionMethod · 0.85

Calls 4

findFreePortMethod · 0.80
getMethod · 0.65
ErrorFunction · 0.50
hasMethod · 0.45

Tested by

no test coverage detected