1. Installation¶
1.1. Introduction¶
Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. Through Selenium Python API you can access all functionalities of Selenium WebDriver in an intuitive way.
Selenium Python bindings provide a convenient API to access Selenium WebDrivers like Firefox, Ie and Chrome. The current supported Python versions are Python 2.6 and Python 2.7. Python 3 is not yet supported. Selenium server is a Java program. Java Runtime Environment (JRE) 1.6 is recommended to run Selenium server. This article explain using Selenium 2 with WebDriver API. Selenium 1 API is not covered here.
1.2. Downloading Selenium server¶
Note
The Selenium server is only required, if you want to use the remote WebDriver. See the `Using Selenium with remote WebDriver`_ section for more details.
You can download Selenium server 2.x from the download page of
selenium website. The file name
should be something like this:
selenium-server-standalone-2.x.x.jar
. You can always download the
latest 2.x version of Selenium server.
If Java Runtime Environment (JRE) is not installed in your system, you can download the JRE from the Oracle website. If you have root access in your system, you can also use your operating system instructions to install JRE.
1.3. Downloading Python bindings for Selenium¶
You can download Python bindings for Selenium from the PyPI page for selenium package. It has a dependency on rdflib , version 3.1.x.
You can also use easy_install or pip to install the bindings:
easy_install selenium
or:
pip install selenium
You may consider using virtualenv to create isolated Python environments.
1.4. Running Selenium server¶
You should have Java Runtime Environment (JRE) in the system. If
java command is available in the PATH (environment variable), you
can start the Selenium server using the command command given below.
Replace 2.x.x with actual version of Selenium server you downloaded
from the site. If JRE is installed as a non-root user and/or if it is
not available in the PATH (environment variable), you can type the
relative/absolute path to the java command, for eg:-
./jre1.6.0_26/bin/java
:
java -jar selenium-server-standalone-2.x.x.jar