Skip to content

Instantly share code, notes, and snippets.

@alaydeliwala
Created March 9, 2021 21:46
Show Gist options
  • Save alaydeliwala/f925f187271dbd1a44f1e9fa6260e0f7 to your computer and use it in GitHub Desktop.
Save alaydeliwala/f925f187271dbd1a44f1e9fa6260e0f7 to your computer and use it in GitHub Desktop.
A sample selenium test using a remote webdriver
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