Selenium is an umbrella project encapsulating a variety of tools and libraries enabling web browser automation. Selenium specifically provides infrastructure for the W3C WebDriver specification — a platform and language-neutral coding interface compatible with all major web browsers.
The project is made possible by volunteer contributors who've generously donated thousands of hours in code development and upkeep.
Selenium's source code is made available under the Apache 2.0 license.
Please read CONTRIBUTING.md before submitting your pull requests.
Selenium uses a custom build system, aptly named crazyfun available on all fine platforms (Linux, Mac, Windows). We are in the process of replacing crazyfun with buck, so don't be alarmed if you see directories carrying multiple build directive files. For reference, crazyfun's build files are named build.desc, while buck's are named simply BUCK.
Before building, ensure that you have Chrome browser installed and the
chromedriver that matches
your Chrome version available on your
$PATH. You may have to update this from time to time.
To build Selenium, in the same directory as this file:
The order of building modules is determined by the build system. If you want to build an individual module (assuming all dependent modules have previously been built), try the following:
In this case,
test is a target in that directory's
run is the action to run on that target.
As you see build targets scroll past in the log,
you may want to run them individually.
crazyfun can run them individually,
by target name, as long as
:run is appended (see above).
To list all available targets, you can append the
Although the plan is to return to a vanilla build of Buck as soon as possible, we currently use a fork hosted at https://github.com/SeleniumHQ/buck
buckw wrapper utility that automatically downloads buck if necessary and runs it with the specified options.
To obtain a list of all available targets:
And build a particular file:
buckw build //java/client/src/org/openqa/selenium:webdriver-api
There are aliases for commonly invoked targets in the
file, and these aliases can be invoked directly:
buckw build htmlunit
All buck output is stored under "buck-out", with the outputs of build
If you are doing a number of incremental builds, then you may want to
buckd, which starts a long-lived buck process to watch outputs
and input files. If you do this, consider using
watchman too, since
the Java 7 file watcher isn't terribly efficient. This can be cloned
- Java 8 JDK
jaron the PATH (make sure you use
javaexecutable from JDK but not JRE)
- Python 2.7
pythonon the PATH (make sure it's Python 2.7, as buck build tool is not Python 3 compatible)
The Requests Library for Python:
pip install requests
- MacOS users should have XCode installed
Although the build system is based on rake, it's strongly advised
to rely on the version of JRuby in
third_party/ that is invoked by
go. The only developer type who would want to deviate from this is
the “build maintainer” who's experimenting with a JRuby upgrade.
Note that all Selenium Java artifacts are built with Java 8 (mandatory). Those will work with any Java >= 8.
- Python 3.4+ (if you want to run Python tests for this version)
- Ruby 2.0
Internet Explorer Driver
If you plan to compile the IE driver, you also need:
- Visual Studio 2008
- 32 and 64 bit cross compilers
The build will work on any platform, but the tests for IE will be skipped silently if you are not building on Windows.
For an express build of the binaries we release, run the following from
the directory containing the
All build output is placed under the
build directory. The output can
be found under
build/dist. If an error occurs while running this
task complaining about a missing Albacore gem, chances are you're
rvm. If this is the case, switch to the system ruby:
Of course, building the entire project can take too long. If you just want to build a single driver, then you can run one of these targets:
./go chrome ./go firefox ./go ie
As the build progresses, you'll see it report where the build outputs are being placed. Of course, just building isn't enough. We should really be able to run the tests too. Try:
./go test_chrome ./go test_firefox ./go test_htmlunit ./go test_ie
Note that the
test_chrome target requires that you have the separate
binary available on your
If you are interested in a single language binding, try one of:
To run all the tests, run:
This will detect your OS and run all the tests that are known to be stable, for every browser that's appropriate to use, for all language bindings. This can take a healthy amount of time to run.
To run the minimal logical Selenium build:
As a side note, none of the developers run tests using Cygwin. It is very unlikely that the build will work as expected if you try to use it.
Now, navigate to
You'll find the contents of the
We use the Closure
The tests in this directory are normal HTML files with names ending
_test.html. Click on one to load the page and run the test. You
Maven POM files
Here is the public Selenium Maven repository.
./go only makes a top-level
build directory. Outputs are placed
under that relative to the target name. Which is probably best
described with an example. For the target:
The output is found under:
If you watch the build, each step should print where its output is
going. Java test outputs appear in one of two places: either under
build/test_logs for JUnit or in
build/build_log.xml for TestNG
tests. If you'd like the build to be chattier, just append
to the build command line.
More general, but basic, help for
go is just a wrapper around
Rake, so you can use the standard
commands such as
rake -T to get more information about available
Maven per se
If it is not clear already, Selenium is not built with Maven. It is
built with Buck,
though that is invoked with
go as outlined above, so you do not really
have to learn too much about that.
That said, it is possible to relatively quickly build Selenium pieces
for Maven to use. You are only really going to want to do this when
you are testing the cutting-edge of Selenium development (which we
welcome) against your application. Here is the quickest way to build
and deploy into your local maven repository (
skipping Selenium's own tests.
The maven jars should now be in your local
~/.m2/repository. You can also publish
directly using Buck:
buckw publish -r your-repo //java/client/src/org/openqa/selenium:selenium
This sequence will push some seven or so jars into your local Maven repository with something like 'selenium-server-3.0.0.jar' as the name.
Refer to the Building Web Driver wiki page for the last word on building the bits and pieces of Selenium.