MCPcopy Create free account
hub / github.com/tebeka/selenium / testWait

Function testWait

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

Source from the content-addressed store, hash-verified

1889}
1890
1891func testWait(t *testing.T, c config) {
1892 const newTitle = "Title changed."
1893 titleChangeCondition := func(wd WebDriver) (bool, error) {
1894 title, err := wd.Title()
1895 if err != nil {
1896 return false, err
1897 }
1898
1899 return title == newTitle, nil
1900 }
1901
1902 wd := newRemote(t, c)
1903 defer quitRemote(t, wd)
1904
1905 titleURL := serverURL + "/title"
1906
1907 if err := wd.Get(titleURL); err != nil {
1908 t.Fatalf("wd.Get(%q) returned error: %v", titleURL, err)
1909 }
1910
1911 // Testing when the title should change.
1912 if err := wd.Wait(titleChangeCondition); err != nil {
1913 t.Fatalf("wd.Wait(titleChangeCondition) returned error: %v", err)
1914 }
1915
1916 // Reloading the page.
1917 if err := wd.Get(titleURL); err != nil {
1918 t.Fatalf("wd.Get(%q) returned error: %v", titleURL, err)
1919 }
1920
1921 // Testing when the Wait() should error the timeout..
1922 if err := wd.WaitWithTimeout(titleChangeCondition, 500*time.Millisecond); err == nil {
1923 t.Fatalf("wd.Wait(titleChangeCondition) should returned error, but it didn't.")
1924 }
1925}
1926
1927func testAcceptAlert(t *testing.T, c config) {
1928 wd := newRemote(t, c)

Callers

nothing calls this directly

Calls 6

newRemoteFunction · 0.85
quitRemoteFunction · 0.85
TitleMethod · 0.65
GetMethod · 0.65
WaitMethod · 0.65
WaitWithTimeoutMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…