This is a WebDriver client for Go, supporting the WebDriver protocol for Chrome and ChromeDriver.
Run
go get -u github.com/radutopala/webdriver
to fetch the package.
The package requires a working WebDriver installation, which can include recent versions of a web browser being driven by Selenium WebDriver.
The API documentation is at https://godoc.org/github.com/radutopala/webdriver. See the unit tests for better usage information.
Download and pack the ChromeDriver binaries:
$ go run download/download.go
You only have to do this once initially and later when version numbers in download.go change.
Run the tests:
$ go test
-
There is one top-level test for Chrome and ChromeDriver.
-
There are subtests that are shared between both top-level tests.
-
To run only the top-level tests, pass:
-test.run=TestChrome
-
To run a specific subtest, pass
-test.run=TestChrome/<subtest>
as appropriate. This flag supports regular expressions. -
If the Chrome binaries or the ChromeDriver binary cannot be found, the corresponding tests will be skipped.
-
The binaries under test can be configured by passing flags to
go test
. See the available flags withgo test --arg --help
. -
Add the argument
-test.v
to see detailed output from the test automation framework.
To ensure hermeticity, we also have tests that run under Docker. You will need an installed and running Docker system.
To run the tests under Docker, run:
$ go test --docker
This will create a new Docker container and run the tests in it. (Note: flags supplied to this invocation are not carried through to the go test
invocation within the Docker container).
For debugging Docker directly, run the following commands:
$ docker build -t webdriver testing/
$ docker run --volume=${GOPATH?}:/code --workdir=/code/src/github.com/radutopala/webdriver -it webdriver bash
This project is licensed under the MIT license.
Please note that this project is a cut-down version of tebeka/selenium, with ideas from Symfony/Panther, targeting only the Chrome WebDriver implementation.