(t *testing.T, c config)
| 459 | } |
| 460 | |
| 461 | func 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 | |
| 515 | func newRemote(t *testing.T, c config) WebDriver { |
| 516 | caps := newTestCapabilities(t, c) |
no test coverage detected