A browser automation framework and ecosystem.
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
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.mdbefore submitting your pull requests.
In order to build Selenium, you'll generally use the
is a Rake script, which wraps the main build too,
Bazel was built by the fine folks at Google. Bazel manages dependency downloads, generates the Selenium binaries, executes tests and does it all rather quickly.
Ensure that you have Chrome installed and the[
](https://chromedriver.chromium.org/downloads) that matches your Chrome version available on your
. You may have to update this from time to time.
To build the most commonly-used modules of Selenium from source, execute this command from the root project folder:
bazel build java/...
The order the modules are built 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,
is the module directory,
is a target in that directory's
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
is appended (see above).
To list all available targets, you can append the
on the PATH (make sure you use
executable from JDK but not JRE).
. This command won't exist if you only have the JRE installed. If you're met with a list of command-line options, you're referencing the JDK properly.
on the PATH
pip install requests
Although the build system is based on rake, it's strongly advisedto rely on the version of JRuby in
that is invoked by
. The only developer type who would want to deviate from this is the “build maintainer” who's experimenting with a JRuby upgrade.
If you plan to compile theIE driver, you also need:
The build will work on any platform, but the tests for IE will be skipped silently if you are not building on Windows.
To build the bulk of the Selenium binaries from source, run the following command from the root folder:
To build the grid deployment jar, run this command:
bazel build grid
To run tests within a particular area of the project, use the "test" command, followed by the folder or target. Tests are tagged with "small", "medium", or "large", and can be filtered with the
bazel test --test\_size\_filters=small,medium java/...
Bazel's "test" command will run all tests in the package, including integration tests. Expect the
to launch browsers and consume a considerable amount of time and resources.
bazel run debug-server
The tests in this directory are normal HTML files with names ending with
Here is the public Selenium Maven repository.
only makes a top-level
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
for JUnit or in
for TestNGtests. If you'd like the build to be chattier, just append
to the build command line.
More general, but basic, help for
is just a wrapper aroundRake, so you can use the standard commands such as
to get more information about available targets.
If it is not clear already, Selenium is not built with Maven. It is built with
, though that is invoked with
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 (
), while skipping Selenium's own tests.
The maven jars should now be in your local
Refer to the Building Web Driverwiki page for the last word on building the bits and pieces of Selenium.
Bazelisk is a Mac-friendly launcher for Bazel. To install, follow these steps:
brew tap bazelbuild/tap && \ brew uninstall bazel; \ brew install bazelbuild/tap/bazelisk
If you're getting errors that mention Xcode, you'll need to install the command-line tools.
Bazel for Mac requires some additional steps to configure properly. First things first: use the Bazelisk project (courtesy of philwo), a pure golang implementation of Bazel. In order to install Bazelisk, first verify that your Xcode will cooperate: execute the following command:
If the value is
, you can proceed with bazelisk installation. If, however, the return value is
, you'll need to redirect the Xcode system to the correct value.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/ sudo xcodebuild -license
The first command will prompt you for a password. The second step requires you to read a new Xcode license, and then accept it by typing "agree".
(Thanks to this thread for these steps)