Wednesday, May 4, 2016

Selenium Robot Framework Installation with Python


To use Robot Framework with Python, you need to install Python, robot framework, Selenium2Library and other supporting libraries. 

Step 1: Install Python 2.7 version
        Before installing Robot Framework, you need to install Python 2.5 or later. Robot Framework has not been updated to work with Python 3 or above, so you should certainly install Python 2.7 version. Visit the link to download and install Python 2.7 version. After installing Python 2.7, add your python installation to your system environment path. 

on Windows, add "c:\Python27\;c:\Python27\Scripts\;" to your path. On Windows vista or Windows 7 environment, it is recommended to install Python to all users, and to run the installation as an administrator. After installing, you can confirm python installation with the command below. 

Step 2: Verify Python 2.7 version

 python --version

 command result will be

 Python 2.7.6

 Step 3: install robot framework with pip command. When you install Python, pip application will be installed automatically. If you are familiar with installing Python packages and have pip available, just run the following command.

 pip install robotframework

 Step 4: Verify robot framework installation
After a successful installation with Python, you should be able to  execute the following commands on the command prompt to verify the installation. 

pybot --version

 Command Result

 Robot Framework 2.8.4 (Python 2.7.6 on win32)

Step 5: Install Selenium2Library
You can install robotframework-selenium2library by downloading the packaged executable file or using the python pip application. Here is the link to download. Use the following command to install robotframework-selenium2library with pip. 

pip install robotframework-selenium2library

 Step 6: Install Selenium Library
Since Selenium2Library has some dependencies for selenium library, you need to install selenium library. The easy way of installing selenium library is to use pip. You can use the following command to install selenium.

 pip install -U selenium

 Step 7:  Install the Selenium robot framework IDE - RIDE
RIDE is a light-weight and intuitive editor for Robot Framework test case files. Since RIDE uses wxpython 2.8, you need to install the package as well. Visit the link for details. RIDE does not yet support Python 3. On OS X RIDE requires 32-bit Python version. 

To install wxpython 2.8 or later version, visit the wxpython.org download page and download the version depending on your OS. Please note that the package has 32 bit and 64 bit, so you need to install the corresponding package depending on your operating system version. 

To install RIDE, you can use pip with the following command. 

 pip install robotframework-ride

 Step 8: Verify RIDE Installation
After a successful installation, RIDE can be started from the command line by running

 ride.py 

 Alternatively you can specify a file or directory to open as an argument like ride.py path/to/tests. Starting from RIDE 0.54, you can also create a desktop shortcut during installation on Windows.

On Windows running ride.py requires having <PythonInstallationDir>\Scripts on PATH. If pybot command to run tests with Robot Framework works you should be fine. If it does not, see Robot Framework installation instructions for more information about setting PATH. When RIDE starts, you will see the UI as shown below. This screenshot has a MaharaDemoTest created by RIDE Program.



No comments:

Post a Comment