lucyxss / webdriver

Chrome WebDriver Client for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chrome WebDriver Client for Go

GoDoc Travis Go Report Card

About

This is a WebDriver client for Go, supporting the WebDriver protocol for Chrome and ChromeDriver.

Installing

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.

Documentation

The API documentation is at https://godoc.org/github.com/radutopala/webdriver. See the unit tests for better usage information.

Downloading and Pack Dependencies

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.

Testing Locally

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 with go test --arg --help.

  • Add the argument -test.v to see detailed output from the test automation framework.

Testing With Docker

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

License

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.

About

Chrome WebDriver Client for Go

License:MIT License


Languages

Language:Go 100.0%Language:Shell 0.0%Language:Dockerfile 0.0%Language:CSS 0.0%