(t *testing.T, c config)
| 637 | } |
| 638 | |
| 639 | func testError(t *testing.T, c config) { |
| 640 | wd := newRemote(t, c) |
| 641 | defer quitRemote(t, wd) |
| 642 | |
| 643 | _, err := wd.FindElement(ByID, "no-such-element") |
| 644 | if err == nil { |
| 645 | t.Fatal("wd.FindElement(ByID, 'no-such-element') did not return an error as expected") |
| 646 | } |
| 647 | |
| 648 | e, ok := err.(*Error) |
| 649 | if !ok { |
| 650 | if c.seleniumVersion.Major > 0 { |
| 651 | // t.Skipf("Selenium does not support W3C-style errors.") |
| 652 | } else { |
| 653 | t.Fatalf("wd.FindElement(ByID, 'no-such-element') returned an error that is not an *Error: %v", err) |
| 654 | } |
| 655 | } |
| 656 | if want := "no such element"; e.Err != want { |
| 657 | t.Errorf("wd.FindElement(ByID, 'no-such-element'); err.Err = %q, want %q", e.Err, want) |
| 658 | } |
| 659 | |
| 660 | var wantCode, wantLegacyCode int |
| 661 | switch c.browser { |
| 662 | case "chrome": |
| 663 | if wd.(*remoteWD).w3cCompatible { |
| 664 | wantCode = 404 |
| 665 | wantLegacyCode = 0 |
| 666 | } else { |
| 667 | wantCode = 200 |
| 668 | wantLegacyCode = 7 |
| 669 | } |
| 670 | case "firefox": |
| 671 | wantCode = 404 |
| 672 | case "htmlunit": |
| 673 | wantCode = 500 |
| 674 | wantLegacyCode = 7 |
| 675 | } |
| 676 | if e.HTTPCode != wantCode { |
| 677 | t.Errorf("wd.FindElement(ByID, 'no-such-element'); err.HTTPCode = %d, want %d", e.HTTPCode, wantCode) |
| 678 | } |
| 679 | if e.LegacyCode != wantLegacyCode { |
| 680 | t.Errorf("wd.FindElement(ByID, 'no-such-element'); err.LegacyCode = %d, want %d", e.LegacyCode, wantLegacyCode) |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | func testExtendedErrorMessage(t *testing.T, c config) { |
| 685 | // Bypass NewRemote which itself calls NewSession internally. |
nothing calls this directly
no test coverage detected
searching dependent graphs…