Tuesday 30 December 2014

Installing Python & Selenium



Why Python ?

Python is my favorite Programming Language and it also happens be the only Programming Language I know.
C-Programming Language is the most widely used language of all times because it is a simple language to learn. JAVA is also widely used because it is an OBJECT-ORIENTED Programming Language.
Python has the simplicity of C-Programming-language and is an OBJECT-ORIENTED Programming Language like JAVA.

For developing games in Python we can use---pygame
For Testing we can use modules -----------------unittest, pytest,nose
For web-development-------------------------------django
For standalone Application-------------------------tkinter
For web-scrapping-----------------------------------urlib, BeautifulSoup

Google use python for its Search Engine
Instagram and Pinterest use Python's Django Framework

_______________*******_____________________********____________________________

Installing Python 

Step 1
Download Python from this URL or from "http://www.python.org"


 Step 2 :Open the Downloaded Python Installer



Step 3:Install python for all users




Python will be installed at C:\Python34\




Installation Begins



Installation Continues


Finally it is over


Step 4:Go to Start and type IDLE in the search box



Step 5:Open IDLE  
Step 6: type "import this"
___________________________******___________________******_____________________

Configuring Python from Windows Command Line

Now in order to use Python from Window Command Line, we need to configure the PATH variable found in the SYSTEM VARIABLES

Step 1: Right click on My Computer and Select Properties
Step 2:Select Advanced System settings


Step 3: We need to change System Variable which is found in Environment Variables



Step 4: In System Variables we need to edit PATH variable, so Select PATH and Click Edit Button


Step 5: Editing the PATH variable
Please add  ;C:\Python34\
Don't leave any space after the last \

After changing the PATH variable click on OK Button.

Step 6: Clicking OK again

Step 7: Go to start and type CMD  in the search box

Step 8: Running python from windows Command Line


Now Type python in the command Prompt


___________________________******___________________******_____________________


What is Selenium??

Selenium is an open source web-UI automation tool.
In particular let us focus on Selenium 2.0 (webdriver). WebDriver is a clean, fast framework for 
automation of web application

Key Features

  • Multiple-browser support.Firefox,Chrome,Safari,Opera & IE
  • Multiple-OS support.Windows,Linux,Android & IOS
  • Multiple Language Support. Python,Ruby,Java


Installing Selenium--(Selenium webdriver)

Step 1:Run windows command shell prompt as Administrator

Step 2: Windows Shell opens 

Now type C:\Python34\Scripts\pip.exe install selenium 
in the shell 
   

The Download starts

Download Complete



Step 3: Verify the installation of selenium

We will access Python by Window shell by typing python



 __________________________*******________________****______________________

Example 1---Using Selenium let us open Firefox browser

Step 1: we need to  import webdriver from Selenium



Step 2: create a firefox browser object





Example 2---Using Selenium to navigate to any valid URL

Step 1: we need to  import webdriver from selenium


Step 2: create a firefox browser object



Step 3: Navigate to "http://yahoo.com"
we can navigate to any valid URL using get--method.





Example 3 ----Open a particular web-page and verify if Selenium has indeed opened the correct webpage


Step 1: we need to  import webdriver from selenium



Step 2:create a firefox browser object



Step 3: Navigate to "http://pythonselenium.blogspot.com"
we can navigate to any valid URL using get--method.



Step 4: Finding the Title of any given webpage
we can find it by this command.




Step 5: In-order to verify that selenium has opened the correct web-page we verify it using title of web-page



Step 6: Closing the browser



The complete code for Example 3

4 comments:

  1. Jackpot City Review 2021 | Casino Sites
    Jackpot 블랙 잭 만화 City Casino is powered by Microgaming software bet365es and boasts a massive progressive jackpot of around €500 유흥업소 사이트 a month. Read our honest review here! Rating: 4 포커 배열 키보드 · ‎Review 알바로 모라타 by Casino Sites

    ReplyDelete
  2. Very Informative blog article. Please keep uploading these types of articles. Data Science Classes in Nagpur, Data Science Courses in Nagpur | Data Science Training in Nagpur. Thank You...

    ReplyDelete