Set up Python for Selenium Test Automation

By | 12/07/2013

As you know, one of strong side of Selenium Webdriver is to support several known programming languages. You can write you script in Java, Python, C# and etc. You can find languages that supported and their client at this link (Selenium Client & WebDriver Language Bindings section). Today, i’d like to show how can you set up your development environment for Python.

First of all, you need to install Python. You can download from here. I use 2.7.X version and selecting 3.x is depend on your choices. after you installed it to your computer, next step is to get Selenium Webdriver libraries for Python. You can download Selenium libraries manually from this link.

but, my suggestion and easier way is to install Selenium via “pip” tool that already provided by Python. you can install libraries automatically by following command: pip install -U selenium

you can run this command from your terminal(terminal in Linux or CMD shell in Windows).

just that. !! it is ready to write your Python script for Selenium. The simpliest way to check your configuration is correct, write following code pieces:

from selenium import webdriver

driver = webdriver.Firefox()
driver.get(“http://www.mahsumakbas.net”)

driver.close()

Leave a Reply

Your email address will not be published. Required fields are marked *

*