Programming Language Preference
Python Client Driver Configuration¶
- Download Selenium-RC from the SeleniumHQ downloads page
- Extract the file selenium.py
- Either write your Selenium test in Python or export a script from Selenium-IDE to a python file.
- Add to your test’s path the file selenium.py
- Run Selenium server from the console
- Execute your test from a console or your Python IDE
The following steps describe the basic installation procedure. After following this, the user can start using the desired IDE, (even write tests in a text processor and run them from command line!) without any extra work (at least on the Selenium side).
This will cover python installation on Windows and Mac only, as in most linux distributions python is already pre-installed by default.
- Download Active python’s installer from ActiveState’s official site: http://activestate.com/Products/activepython/index.mhtml
- Run the installer downloaded (ActivePython-x.x.x.x-win32-x86.msi)
The latest Mac OS X version (Leopard at this time) comes with Python pre-installed. To install an extra Python, get a universal binary at http://www.pythonmac.org/ (packages for Python 2.5.x). You will get a .dmg file that you can mount. It contains a .pkg file that you can launch.
Installing the Selenium driver client for python
Download the last version of Selenium Remote Control from the downloads page
Extract the content of the downloaded zip file
Copy the module with the Selenium’s driver for Python (selenium.py) in the folder C:/Python25/Lib (this will allow you to import it directly in any script you write).
You will find the module in the extracted folder, it’s located inside selenium-python-driver-client.
Congratulations, you’re done! Now any python script that you create can import selenium and start interacting with the browsers.