Created
March 9, 2021 21:46
-
-
Save alaydeliwala/f925f187271dbd1a44f1e9fa6260e0f7 to your computer and use it in GitHub Desktop.
A sample selenium test using a remote webdriver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var executorGuestUrl = "http://127.0.0.1/wd/hub" | |
func main() { | |
var caps = make(selenium.Capabilities) | |
caps["browserName"] = "chrome" | |
caps["name"] = "[Go] Sample Test" | |
expectedTitle := "The Go Programming Language" | |
wd, err := selenium.NewRemote(caps, executorGuestUrl) | |
if err != nil { | |
log.Print(err) | |
return | |
} | |
c, err := wd.Capabilities() | |
log.Print(c) | |
wd.Get("http://golang.org/") | |
actualTitle, _ := wd.Title() | |
if actualTitle != expectedTitle { | |
log.Fatalf("title %q, got %q", expectedTitle, actualTitle) | |
} | |
wd.Quit() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment