Install a Selenium library

Setting up the Selenium library for your favourite programming language.

First you need to install the Selenium bindings for your automation project. The installation process for libraries depends on the language you choose to use. Make sure you check the Selenium downloads page to make sure you are using the latest version.

Requirements by language

Installation of Selenium libraries for Java is accomplished using a build tool. You can see all available versions on Maven Repository

For Maven, add the selenium-java dependency in your project pom.xml file:


For Gradle, add the selenium-java dependency in your project build.gradle file:

dependencies {
    compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.0.0'

Installation of Selenium libraries for Python can be done using pip:

pip install selenium

Alternatively you can download the PyPI source archive (selenium-x.x.x.tar.gz) and install it using

python install

Installation of Selenium libraries for C# can be done using NuGet in one of two ways

  • Using a Packet Manager:
Install-Package Selenium.WebDriver
  • Using .NET CLI
dotnet add package Selenium.WebDriver

Supported .NET Versions

Make sure to use the .NET SDK version compatible with relevant Selenium package. Check the dependencies section to find out the supported .NET version. At the time of this update, .NET 5.0 (Visual Studio 2019) is known to be supported, and .NET 6.0 is not supported. You can download MSBuild Tools 2019 from here to install the needed components and dependencies such as .NET SDK and NuGet Package Manager.

Using Visual Studio Code (vscode) and C#

This is a quick guide to help you get started with vscode and C#, however, more research may be required. Install the compatible .NET SDK as per the section above. Also install the vscode extensions (Ctrl-Shift-X) for C# and NuGet. Follow the instruction here to create and run the “Hello World” console project using C#. You may also create a NUnit starter project using the command line dotnet new NUnit. Make sure the file %appdata%\NuGet\nuget.config is configured properly as some developers reported that it will be empty due to some issues. If nuget.config is empty, or not configured properly, then .NET builds will fail for Selenium Projects. Add the following section to the file nuget.config if it is empty:

    <add key="" value="" protocolVersion="3" />
    <add key="" value="" />   

For more info about nuget.config click here. You may have to customize nuget.config to meet you needs.

Now, go back to vscode, press Ctrl-Shift-P, and type “NuGet Add Package”, and enter the required Selenium packages such as Selenium.WebDriver. Press Enter and select the version. Now you can use the examples in the documentation related to C# with vscode.

Installation of Selenium libraries for Ruby can be done using gem:

gem install selenium-webdriver

Or add it to your Gemfile:

gem 'selenium-webdriver', '~> 4.0'

Installation of Selenium libraries for JavaScript can be done using npm:

npm install selenium-webdriver
Use the Java bindings for Kotlin.

Next Step

Install the browser drivers

Last modified March 14, 2022: Fix: Minor typo errors (9cab8d79c2d)