Monday 22 December 2014

WORKING WITH CHROME WEBDRIVER

What is  a CHROME WebDriver ??

It is an open Source Tool for Automated Testing of Web-Pages in Google Chrome.
It provides capabilities for
  1.  Navigating to web pages
  2.  User input
  3.  JavaScript execution, and more.

Installing CHROME WebDriver

Step 1
          Download the latest Release from chrome webdriver Page
Step 2
          Unzip the downloaded file(chromedriver_win32)
Step 3
           After Unzip we have chromedriver file copy this file to C:\Python\Scripts\
Step4
     
         Open IDLE and type,
 

Chrome is Up & Running.





Steps to be followed before writing a Test Scrips

  1. Understand the Requirement 
  2. Write Test Plan and Test Cases
  3. Decide which Test Case to Automate
  4. Inspect the required Web UI elements  
  5. Starting writing your Test Script
Example 1:---LogIn to your Gmail Account Verify your Username in the HomePage
 and then LogOut.

Step 1

Requirement:Accessing your Gmail Account using Selenium(Gmail Sign In)

Step 2


Test Scenarios
  1. Enter a Valid UserName ,Password & login,check for the Username in  the HomePage.
  2. Logout and check for the Gmail Login Page.
Test Case
     Log In
  1. Open the Browser.
  2. Navigate to "http://gmail.com"
  3. Verify the Title of Gmail Login Page.
  4. Enter the Username and Password and click submit.
  5. Verify the  Username in the HomePage
   Logout 
  1. Hover Over the Username in the Home Page
  2. Click the LogOut Button
  3.  Verify the Title of Gmail Login Page.

Step 3

Inspection of Web UI elements using FireBug & FirePath.
We are going to use FireBug to extracting the HTML ID ,HTML NAME  of UI elements.
FireBug can be downloaded from this URL

Working With FireBug

Step 1 :
           
           Open FireBug
             



 Step 2 : 
            
            Inspecting elements with FireBug 
           Right click over the element to be inspected.
   

           For LogIn Test Case
            1)Username Inspection
            
         
        Username can be located using HTML ID & NAME
      


   2)Password Inspection
          
       Password can be located using HTML ID & NAME
      

     3)SignIn Button Inspection
           

               Submit Button can be located using HTML ID & NAME


             Working With FirePath

              To access the xpath of Web - UI elements
              FirePath can be downloaded from this URL
                Step 1 :
               Select FirePath















 Step 2 :
                For LogOut Test Case

                 1)Inspect the Username in HomePage
Xpath for Username found in the HomePage
            
2)Inspect SignOut
     




       Finally the Test Script



Output




  
 



No comments:

Post a Comment