{"id":13895115,"url":"https://github.com/sourcegraph/go-selenium","last_synced_at":"2025-07-17T10:32:41.183Z","repository":{"id":8729923,"uuid":"10403471","full_name":"sourcegraph/go-selenium","owner":"sourcegraph","description":"Selenium WebDriver client for Go","archived":false,"fork":false,"pushed_at":"2024-02-02T17:33:53.000Z","size":292,"stargazers_count":366,"open_issues_count":15,"forks_count":73,"subscribers_count":92,"default_branch":"master","last_synced_at":"2024-08-07T18:32:41.081Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://sourcegraph.com/github.com/sourcegraph/go-selenium","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sourcegraph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-05-31T11:20:20.000Z","updated_at":"2024-07-27T16:22:16.000Z","dependencies_parsed_at":"2024-06-18T15:41:51.628Z","dependency_job_id":null,"html_url":"https://github.com/sourcegraph/go-selenium","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcegraph%2Fgo-selenium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcegraph%2Fgo-selenium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcegraph%2Fgo-selenium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcegraph%2Fgo-selenium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sourcegraph","download_url":"https://codeload.github.com/sourcegraph/go-selenium/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226255334,"owners_count":17595859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T18:02:00.630Z","updated_at":"2024-11-25T00:30:54.854Z","avatar_url":"https://github.com/sourcegraph.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"==============================================\ngo-selenium - Selenium WebDriver client for Go\n==============================================\n\ngo-selenium is a [Selenium](http://seleniumhq.org) WebDriver client for [Go](http://golang.org).\n\nNote: the public API is experimental and subject to change until further notice.\n\n\nUsage\n=====\n\nDocumentation: [go-selenium on Sourcegraph](https://sourcegraph.com/github.com/sourcegraph/go-selenium).\n\nExample: see example_test.go:\n\n```go\npackage selenium_test\n\nimport (\n\t\"fmt\"\n\t\"sourcegraph.com/sourcegraph/go-selenium\"\n)\n\nfunc ExampleFindElement() {\n\tvar webDriver selenium.WebDriver\n\tvar err error\n\tcaps := selenium.Capabilities(map[string]interface{}{\"browserName\": \"firefox\"})\n\tif webDriver, err = selenium.NewRemote(caps, \"http://localhost:4444/wd/hub\"); err != nil {\n\t\tfmt.Printf(\"Failed to open session: %s\\n\", err)\n\t\treturn\n\t}\n\tdefer webDriver.Quit()\n\n\terr = webDriver.Get(\"https://sourcegraph.com/sourcegraph/go-selenium\")\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to load page: %s\\n\", err)\n\t\treturn\n\t}\n\n\tif title, err := webDriver.Title(); err == nil {\n\t\tfmt.Printf(\"Page title: %s\\n\", title)\n\t} else {\n\t\tfmt.Printf(\"Failed to get page title: %s\", err)\n\t\treturn\n\t}\n\n\tvar elem selenium.WebElement\n\telem, err = webDriver.FindElement(selenium.ByCSSSelector, \".repo .name\")\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to find element: %s\\n\", err)\n\t\treturn\n\t}\n\n\tif text, err := elem.Text(); err == nil {\n\t\tfmt.Printf(\"Repository: %s\\n\", text)\n\t} else {\n\t\tfmt.Printf(\"Failed to get text of element: %s\\n\", err)\n\t\treturn\n\t}\n\n\t// output:\n\t// Page title: go-selenium - Sourcegraph\n\t// Repository: go-selenium\n}\n```\n\nThe `WebDriverT` and `WebElementT` interfaces make test code cleaner. Each method in\n`WebDriver` and `WebElement` has a corresponding method in the `*T` interfaces that omits the error\nfrom the return values and instead calls `t.Fatalf` upon encountering an error. For example:\n\n```go\npackage mytest\n\nimport (\n  \"sourcegraph.com/sourcegraph/go-selenium\"\n  \"testing\"\n)\n\nvar caps selenium.Capabilities\nvar executorURL = \"http://localhost:4444/wd/hub\"\n\n// An example test using the WebDriverT and WebElementT interfaces. If you use the non-*T\n// interfaces, you must perform error checking that is tangential to what you are testing,\n// and you have to destructure results from method calls.\nfunc TestWithT(t *testing.T) {\n  wd, _ := selenium.NewRemote(caps, executor)\n\n  // Call .T(t) to obtain a WebDriverT from a WebDriver (or to obtain a WebElementT from\n  // a WebElement).\n  wdt := wd.T(t)\n\n  // Calls `t.Fatalf(\"Get: %s\", err)` upon failure.\n  wdt.Get(\"http://example.com\")\n\n  // Calls `t.Fatalf(\"FindElement(by=%q, value=%q): %s\", by, value, err)` upon failure.\n  elem := wdt.FindElement(selenium.ByCSSSelector, \".foo\")\n\n  // Calls `t.Fatalf(\"Text: %s\", err)` if the `.Text()` call fails.\n  if elem.Text() != \"bar\" {\n    t.Fatalf(\"want elem text %q, got %q\", \"bar\", elem.Text())\n  }\n}\n```\n\nSee remote_test.go for more usage examples.\n\n\n\nRunning tests\n=============\n\nStart Selenium WebDriver and run `go test`. To see all available options, run `go test -test.h`.\n\n\nTODO\n====\n\n* Support Firefox profiles\n\n\nContributors\n============\n\n* Quinn Slack \u003csqs@sourcegraph.com\u003e\n* Miki Tebeka \u003cmiki.tebeka@gmail.com\u003e (go-selenium is based on Miki's\n  [github.com/tebeka/selenium](https://github.com/tebeka/selenium) library)\n\n\nLicense\n=======\n\ngo-selenium is distributed under the Eclipse Public License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcegraph%2Fgo-selenium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsourcegraph%2Fgo-selenium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcegraph%2Fgo-selenium/lists"}