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, Chrome, Remote etc.. The current supported Python versions are 2.6, 2.7, 3.2 and 3.3.
This documentation explains Selenium 2 WebDriver API. Selenium 1 / Selenium RC API is not covered here.
pip install selenium
You may consider using virtualenv to create isolated Python environments.
You should have internet connection to perform this installation.
Install Python 2.7 using the MSI available in python.org download page.
Create a folder named C:\seltests
Download virtualenv tar ball inside C:\seltests and extract it. Ensure the tar bal has been extracted to C:\seltests\virtualenv-1.10.1 folder (To extract you can use WinZip or 7-zip)
Start a command prompt (using the cmd.exe program), then change to the C:\seltests\virtualenv-1.10.1 folder and run the virtualenv.py script as given below.
C: cd C:\seltests\virtualenv-1.10.1 C:\Python27\python.exe virtualenv.py C:\seltests\selenv
This step will create a folder named C:\seltests\selenv which contains a virtual Python.
Use the pip command as given below to install selenium
C:\seltests\selenv\Scripts\pip.exe install selenium
Now installation has been completed! You can proceed to test your Selenium scripts.
Now you can run your test scripts using the virtual Python. For example, if you have created a Selenium based script and saved it inside C:\seltests\my_selenium_script.py, you can run it like this.
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.
Selenium server is a Java program. Java Runtime Environment (JRE) 1.6 or newer version is recommended to run Selenium server.
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 are using a GNU/Linux system and have root access in your system, you can also use your operating system instructions to install JRE.
If java command is available in the PATH (environment variable), you can start the Selenium server using this command:
java -jar selenium-server-standalone-2.x.x.jar
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 or absolute path to the java command. Similarly, you can provide relative or absolute path to Selenium server jar file. Then, the command will look something like this:
/path/to/java -jar /path/to/selenium-server-standalone-2.x.x.jar