Friday, 22 July 2016

                                         Selenium Web Driver



Web Driver

Web driver is a collection  of interfaces class and also it is a collection of Jar files.All web Driver API are completely object oriented and it provides native support all the browser and directly communicates with that.
Web Driver is a latest tool available in the selenium Community which removes all the disadvantages of Selenium RC and selenium IDE.

WebDriver supports multiple Lanaguages

1.Java
2.Python
3.Ruby
4 .PHP
5. Perl

Web Driver supports multiple Platform

1. Windows
2.Linux
3.MAC
4.Android
5.I phone

Installation Steps:

(1) Download Web Driver Jar from Community
  Go to google----> Search-----> Download Selenium

(2) Click on first link----->Navigate to Selenium Community

(3) Find on Selenium Client & Web Driver Division
      Click on Download link beside Java

(4) Import All Web Driver Jars to Eclipse
      (1) Open a Eclipse with New Workspace
       (2) Create a Java Project
                    File------>>> New------->>> Java Project


How to Import
  Select Project----->>> Right Click
         (1) Select Build Path Option
         (2) Click on Configure Build Path


Click on Lib Tools in Property Windows

Click on ADD External JARS  Button

Import all Web Driver Jars Available in C drive

click on OK

 After that you ll get--------->>> Referenced Libraries



(1) Locators In Web Driver
   It is used to identify any web Element in UI based on html source code.
                     
                                           By
                                              1. ID()
                                               2.Name()
                                               3.X-path()
                                                4. CSS-Selector()
                                                5. Link Text()
                                                 6.Partial Link Text()
                                                7. ClassName()
                                                8.TagName()

All these are By methods are static class. By is a abstract class

Writing Web Driver Test Scripts Uses typically Uses Five Steps :
         1. Launch Empty Browser
         2. Navigate to any web Based  Application
         3. Find Web Element  in UI
         4. Perform Operations On Web Element
         5. Close Browser.


E.g.....>>>  Public Class My First WebDriver{
                        Public Static Void main (String [] args){
                               
                              // Step 1: Launch Empty Browser
                        WebDriver driver= new Firefox Driver();
                       
                           //Step 2: Naviagte to Gmail App
                               driver.get("http:// gmail.com");
                   
                             //Step 3: Find Username editbox Web Element in UI
                               WebElement wb= driver.findElement(By.id ("Email"));

                              //Step 4: perform Operation on Editbox Web Element
                                Wb.SendKeys ("Testingmania16@gmail.com");
                           
                                //Step 5: Close the Browser
                                  driver.quit();

                           









No comments:

Post a Comment