Saturday, September 19, 2015

Setting selenium Test Environment to work with Python---Eclipse configuration



Eclipse configuration to work with Selenium using PYTHON

In the previous posts, we have seen how to install Python, WxPython, PIP and Selenium Packages.


But, Now it is the time for Eclipse Configuration. In order to use Eclipse to work with Python, you need the following prerequisites.


1.      Eclipse.

2.      PyDev - Python IDE for Eclipse.


Eclipse Download:


Download the latest version of Eclipse from the following URL--https://eclipse.org/downloads/download.php?file=/oomph/epp/mars/R/eclipse-inst-win32.exe&mirror_id=1207

Download and extract the file to a desired location, and click on “eclipse.exe” to launch eclipse.
The view can be like the following screen shot after setting Workspace.
 
Now, the eclipse is not ready for python scripting, why because, eclipse directly does not support Python.

So we need to Install an add on which enables eclipse to work with python. That is “PyDev – Python IDE for Eclipse”. It creates the Python Package Explorer.

It helps to script in Python using Eclipse IDE.

PyDev Installation:

Goto “Eclipse MarketPlace” under HELP menu.
 

Enter “PyDev” in the search box and hit Enter.
 
 

Click on Confirm in the following window.
 
 

Accept License terms & click on Finish button.
 

On the next step, Eclipse will asks you for the permission to continue with the PyDev, In that window, click on Select All & click on Finish to complete the installation process.
 
 

Eclipse won’t supports Python directly, so we Installed Pydev In this, So to get the Python Project Explorer. You follow the following steps.

Pydev Project explorer is available in the Wondow - Prespective - Open Prespective - Other.

 

When you click on other, It will populates the following window, In that select “Pydev” & click on OK.
 
 

When you click on OK, PyDev project explorer can generate at the Left top corner of Eclipse.
 
 
Now, as usual, follow the same process which you follows to create a Java project in Eclipse for Python also.

While creating a first Python project, you have to do some mandatory steps.

When you creating a new Python project for the first time, It will asks you about Project Interpreter.

By that time, give a name to the project & click on “click here to configure an interpreter not listed” and select “Automatically detect Interpreter option”.
 
Click on Finish to create a new Python Project.

A project can be created like below screen shot.
 


Now it is time to create a new Python Package, follow the steps displayed in the below screens shot.
 
Now give a name to the package & click finish to create a new package.
 
Now Right Click on the newly created Package & goto New & Pydev Module to create a new Python class.

 
Give a name to the class and click on finish.
 
Now a new class is created, and that class can appear in the Project Explorer.
 
Write your Selenium Script in the newly created class, and enjoy the Automation.

Note: Please go through the steps in Setting Selenium Test Environment---Python Installation before this process. Otherwise, Selenium won’t work.

  The link is:http://seleniumautomationeasy.blogspot.in/2015/09/setting-selenium-test-envirnment-python.html
 
 
 
       
 

No comments:

Post a Comment