We have to install python in our operating system to use selenium python bindings our project.
1. Navigate to https://www.python.org/downloads/
2. Download the latest version of the Python or a stable version, for this tutorial we will be using python 3 (version above 3 are considered as 3 in general terms)
3. Install the python installer (i am on windows 10 operating system), and select add path
4. After installing, open cmd and type python, you should get version and >>> python editor. If you get them then your python installation is successful.
1. We should have python installed in your system before you try to install selenium
2. You can install selenium just by typing following command on cmd (not on python editor) :
3. Now open python editor just simply entering word python on the command prompt.
4. Below command will not throw any exception if your selenium is installed successfully
Note : Only incase if you are not able to install the selenium using pip command then only try below steps otherwise ignore the below steps.
Sometimes pip command fails to install selenium either due to proxy issues, or due to system configurations issues, in that we have to use below steps to install selenium.
1. Navigate to https://pypi.python.org/pypi/selenium
2. Click on the download button
3. Download the applicable format based on your operating system, below image shows for windows operating system
4. Extract the downloaded zipped file to your local system, and content should look like below.
5. Open command prompt/terminal and navigate to that the unzipped folder.
6. Enter following command to install selenium :
7. Now open python editor just simply entering word python on the command prompt.
8. Following command will not throw any exception if your selenium is installed successfully
We cannot code all the thing in the python editor, which is in command prompt. To edit python code easily we have to use an IDE for development. In this tutorial I will be using Eclipse with PyDev.
1. After installing Eclipse, Goto Help >Eclipse marketplace
2. Now search for "pyDev" and install the software
3. Accept the License and Restart the eclipse.
4. We have to open PyDev perspective to edit python code, Window > Perspective > Open Perspective > Other and choose PyDev
5. Create first Project, File > New > PyDev Project
6. When we use python for first time, we have to set the interpreter, click to configure the interpreter.
7. Click on Auto-config option, and then finish the creating project wizard.
8. Right click on the python project and Create new Pydev Module, and select blank
9. Enter following command in coding area and Click run button in eclipse.
10. You can choose how you want to run either Just python program or as UnitTest Program
Unlike other programming languages, Python provide live editor. which is you can control thr browser entering command by command.
I am not talking about debugging, Debugging is a process where you will checkpoint and run the coomplete program step by step to understand the flow and error
Python console gives the ability to run a live command, for Example : I have opened browser and I Opened Google.com but I realize i want to open Bing.com, now i donot have to stop the program as i am in live editor i just change the commands.
lets see how to open Live console :
1. Open Eclipse console.
2. On Right hand corner, you can find a icon to like rectangagle with + sign, click it.
3. Choose PyDev Console
4. Select Console for current Editor
5. Now you have live console and type the commands that you want to use.
Article is written by Pavan (a) KarthiQ. Well, I am serving notice period in an MNC, Bangalore. I thought to enrich every person knowledge a little, I always have a feeling, when we teach something, we will learn more than what you know.
Knowledge is the only thing that doubles when you spend it.
I have also created the reporter for Protractor Jasmine. Use for your projects without any hesitation