title: “Installing Selenium libraries”
weight: 1
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.
Java
Installation of Selenium libraries for Java can be done using Maven.
Add the selenium-java dependency in your project pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.X</version>
</dependency>
The selenium-java dependency supports running your automation
project with all Selenium supported browsers. If you want to run tests
only in a specific browser, you can add the dependency for that browser
in your pom.xml file.
For example, you should add following dependency in your pom.xml
file to run your tests only in Firefox:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.X</version>
</dependency>
In a similar manner, if you want to run tests only in Chrome,
you should add the following dependency:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.X</version>
</dependency>
Python
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 setup.py:
python setup.py install
C#
Installation of Selenium libraries for C# can be done using NuGet:
# Using package manager
Install-Package Selenium.WebDriver
# or using .Net CLI
dotnet add package Selenium.WebDriver
Ruby
Installation of Selenium libraries for Ruby can be done using gem:
gem install selenium-webdriver
JavaScript
Installation of Selenium libraries for JavaScript can be done using npm:
npm install selenium-webdriver
Kotlin
Due to missing native language bindings for Kotlin, you have to use the Java Bindings, e.g. with maven Java
官方链接为:/documentation/webdriver/getting_started/install_library/