MCPcopy Index your code
hub / github.com/tebeka/selenium / newTestCapabilities

Function newTestCapabilities

remote_test.go:461–513  ·  view source on GitHub ↗
(t *testing.T, c config)

Source from the content-addressed store, hash-verified

459}
460
461func newTestCapabilities(t *testing.T, c config) Capabilities {
462 caps := Capabilities{
463 "browserName": c.browser,
464 }
465 switch c.browser {
466 case "chrome":
467 chrCaps := chrome.Capabilities{
468 Path: c.path,
469 Args: []string{
470 // This flag is needed to test against Chrome binaries that are not the
471 // default installation. The sandbox requires a setuid binary.
472 "--no-sandbox",
473 },
474 W3C: true,
475 }
476 caps.AddChrome(chrCaps)
477 case "firefox":
478 f := firefox.Capabilities{}
479 if c.path != "" {
480 // Selenium 2 uses this option to specify the path to the Firefox binary.
481 //caps["firefox_binary"] = c.path
482 p, err := filepath.Abs(c.path)
483 if err != nil {
484 panic(err)
485 }
486 f.Binary = p
487 }
488 if testing.Verbose() {
489 f.Log = &firefox.Log{
490 Level: firefox.Trace,
491 }
492 }
493 caps.AddFirefox(f)
494 case "htmlunit":
495 caps["javascriptEnabled"] = true
496 }
497
498 if c.sauce != nil {
499 m, err := c.sauce.ToMap()
500 if err != nil {
501 t.Fatalf("Error obtaining map for sauce.Capabilities: %s", err)
502 }
503 for k, v := range m {
504 caps[k] = v
505 }
506 if c.seleniumVersion.Major > 0 {
507 caps["seleniumVersion"] = c.seleniumVersion.String()
508 }
509 caps["name"] = t.Name()
510 }
511
512 return caps
513}
514
515func newRemote(t *testing.T, c config) WebDriver {
516 caps := newTestCapabilities(t, c)

Callers 8

testChromeExtensionFunction · 0.85
testFirefoxPreferencesFunction · 0.85
testFirefoxProfileFunction · 0.85
newRemoteFunction · 0.85
testNewSessionFunction · 0.85
testExtendedErrorMessageFunction · 0.85
testLogFunction · 0.85
testProxyFunction · 0.85

Calls 3

AddChromeMethod · 0.95
AddFirefoxMethod · 0.95
ToMapMethod · 0.80

Tested by

no test coverage detected