A browser automation framework and ecosystem.
Java JavaScript C# C++ HTML Ruby Other
Switch branches/tags
selenium-3.8.1 selenium-3.8.0 selenium-3.7.1 selenium-3.7.0 selenium-3.6.0 selenium-3.5.3 selenium-3.5.2 selenium-3.5.1 selenium-3.5.0 selenium-3.4.0 selenium-3.3.1 selenium-3.3.0 selenium-3.2.0 selenium-3.1.0 selenium-3.0.1 selenium-3.0.0 selenium-3.0.0-beta-4 selenium-3.0.0-beta-3 selenium-3.0.0-beta-2 selenium-3.0.0-beta-1 selenium-2.53.1 selenium-2.53.0 selenium-2.52.0 selenium-2.51.0 selenium-2.50.1 selenium-2.50.0 selenium-2.49.1 selenium-2.49.0 selenium-2.48.2 selenium-2.48.1 selenium-2.48.0 selenium-2.47.1 selenium-2.47.0 selenium-2.46.0 selenium-2.45.0 selenium-2.44.0 selenium-2.43.1 selenium-2.43.0 selenium-2.42.2 selenium-2.42.1 selenium-2.42.0 selenium-2.41.0 selenium-2.40.0 selenium-2.39.0 selenium-2.38.0 selenium-2.37.0 selenium-2.36.0 selenium-2.35.0 selenium-2.33.0 selenium-2.32.0 selenium-2.31.0 selenium-2.30.0 selenium-2.29.0 selenium-2.29.0a selenium-2.28.0 selenium-2.27.0 selenium-2.26.0 selenium-2.25.0 selenium-2.24.1 selenium-2.23.1 selenium-2.23.0 selenium-2.22.0 selenium-2.21.0 selenium-2.20.0 selenium-2.19.0 selenium-2.18.0 selenium-2.17.0 selenium-2.16.0 selenium-2.15.0 selenium-2.14.0 selenium-2.13.0 selenium-2.12.0 selenium-2.11.0 selenium-2.10.0 selenium-2.9.0 selenium-2.8.0 selenium-2.7.0 selenium-2.6.0 selenium-2.5.0 selenium-2.4.0 selenium-2.3.0 selenium-2.2.0 selenium-2.1.0 selenium-2.0.0 selenium-2.0-rc1 selenium-2.0-rc-3 selenium-2.0-rc-2 selenium-2.0-beta-3 selenium-2.0-beta-2 selenium-2.0-beta-1 selenium-2.0-alpha-7 selenium-2.0-alpha-6 selenium-2.0-alpha-5 selenium-2.0-alpha-4 selenium-2.0-alpha-3 selenium-2.0-alpha-2 selenium-2.0-alpha-1 rc-1.0 rc-1.0-beta-2 rc-0.9.2
Nothing to show
Permalink
Failed to load latest commit information.
.github Explain the GeckoDriver situation a little more in the issue template Nov 23, 2016
.idea Bump the java libraries we depend on to their latest versions Dec 28, 2017
common Adding a new test for file upload using a hidden file input. Also dis… Nov 28, 2017
cpp Updating IE prebuilts Nov 28, 2017
dotnet .Net binding API doc improvement. Fixes #1645 Dec 3, 2017
ide Added a bunch of improvements to webdriver playback and scheduler inc… Nov 18, 2016
java Allow SessionFactory to indicate whether they support particular Capa… Dec 30, 2017
javascript Fixing typo that can confuse beginner users Dec 28, 2017
py [py] update CHANGES and bump version to 3.8.1 Jan 4, 2018
rake-tasks External process output should be read asynchronously to avoid deadlocks Nov 30, 2017
rb Prefer "geckodriver" name when looking up binary Dec 28, 2017
scripts Remove commented PhantomJS download code (#4371) Jul 26, 2017
third_party Bump the java libraries we depend on to their latest versions Dec 28, 2017
.OLD_AUTHORS Add target for generating AUTHORS file Dec 9, 2013
.buckconfig Prep .buckconfig for next buck bump Oct 11, 2017
.buckhash Bump the buck version Sep 21, 2017
.buckjavaargs Increasing Java heap space available for buck to 2GB Aug 15, 2017
.buckversion Bump the buck version Sep 21, 2017
.editorconfig Updating .editorconfig to work with Visual Studio 2017 Aug 15, 2017
.git-fixfiles Fix the build Feb 22, 2017
.gitattributes Update .xml in .gitattributes Jun 4, 2015
.gitignore Adding launchSettings.json to gitignore Sep 19, 2017
.mailmap catching two more duplicate authors [ci skip] Oct 21, 2016
.travis.yml [py] add chrome back into travis tests Nov 22, 2017
AUTHORS update AUTHORS Aug 10, 2017
BUCK Start adding a target to generate dist jars Sep 11, 2017
CONTRIBUTING.md add feature requests to CONTRIBUTING May 19, 2017
LICENSE Update License to show copyright belongs to SFC Oct 26, 2016
NOTICE Update NOTICE Jun 8, 2017
README.md Updating requirements to Selenium build environment. Fixes #4956 Dec 2, 2017
Rakefile Bump Java version to 3.8.1 Dec 1, 2017
appveyor.yml Use Ruby 2.0 on CI Oct 14, 2017
copyiedriver.bat Updating .NET online documentation to new presentation style and upda… Jan 18, 2013
generate_api_docs.sh docs: Automatically push Ruby docs to gh-pages Oct 8, 2015
go Bring java flags to same value in "go" Aug 8, 2017
go.bat Bring java flags to same value in "go" Aug 8, 2017
ide.iml missing file May 26, 2013
selenium-version.bzl Bump Java version to 3.8.1 Dec 1, 2017
selenium.iml SimonStewart: Break out a server and client module for the IDEA proje… Mar 9, 2012
sonar-project.properties Adding Sonarqube configuration for Java modules May 22, 2015

README.md

Selenium Travis Status AppVeyor Status

SeleniumHQ

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.

Documentation

Narrative documentation:

API documentation:

Pull Requests

Please read CONTRIBUTING.md before submitting your pull requests.

Building

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 the most recent chromedriver available on your $PATH. You may have to update this from time to time.

To build Selenium, in the same directory as this file:

./go build

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:

./go //javascript/atoms:test:run

In this case, javascript/atoms is the module directory, test is a target in that directory's build.desc file, and 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 -T flag:

./go -T

Buck

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 To build using Buck, first clone that repo and build using ant. Then add Buck's "bin" directory to your PATH.

To obtain a list of all available targets:

buck targets

And build a particular file:

buck build //java/client/src/org/openqa/selenium:webdriver-api

There are aliases for commonly invoked targets in the .buckconfig file, and these aliases can be invoked directly:

buck build htmlunit

All buck output is stored under "buck-out", with the outputs of build rules in buck-out/gen.

If you are doing a number of incremental builds, then you may want to use 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 from https://github.com/facebook/watchman

Requirements

  • Java 8 JDK
  • java and jar on the PATH (make sure you use java executable from JDK but not JRE)

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.

Optional Requirements

  • Python 2.7, Python 3.4+ (without these, Python and Python3 tests will be skipped)
  • Ruby 2.0

Internet Explorer Driver

If you plan to compile the IE 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.

Common Tasks

For an express build of the binaries we release, run the following from the directory containing the Rakefile:

./go release

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 using rvm. If this is the case, switch to the system ruby:

rvm system

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 Chrome Driver binary available on your PATH.

If you are interested in a single language binding, try one of:

./go test_java
./go test_dotnet
./go test_rb
./go test_javascript

To run all the tests, run:

./go test

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:

./go test_javascript test_java

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.

Tour

The code base is generally segmented around the languages used to write the component. Selenium makes extensive use of JavaScript, so let's start there. Working on the JavaScript is easy. First of all, start the development server:

./go debug-server

Now, navigate to http://localhost:2310/javascript. You'll find the contents of the javascript/ directory being shown. We use the Closure Library for developing much of the JavaScript, so now navigate to http://localhost:2310/javascript/atoms/test.

The tests in this directory are normal HTML files with names ending with _test.html. Click on one to load the page and run the test. You can run all the JavaScript tests using:

./go test_javascript

Maven POM files

Here is the public Selenium Maven repository.

Build Output

./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:

./go //java/client/src/org/openqa/selenium:selenium-api

The output is found under:

build/java/client/src/org/openqa/selenium/selenium-api.jar

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 log=true to the build command line.

Help with go

More general, but basic, help for go

./go --help

go is just a wrapper around Rake, so you can use the standard commands such as rake -T to get more information about available targets.

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 (~/.m2/repository), while skipping Selenium's own tests.

./go maven-install

The maven jars should now be in your local ~/.m2/repository. You can also publish directly using Buck:

buck 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.

Useful Resources

Refer to the Building Web Driver wiki page for the last word on building the bits and pieces of Selenium.