Selenium WebDriver Introduction

Introduction to Selenium WebDriver

i) Introduction to Selenium WebDriver

ii) Selenium WebDriver Environment Setup

iii) Write kickoff Selenium Test Case
----------------------------------------------
i) Introduction to Selenium WebDriver

Selenium's Tool Suite
   
    Selenium IDE
    Selenium RC
    Selenium WebDriver
    Selenium Grid
----------------------------------------------
Selenium WebDriver Features:

> In 2006, Selenium WebDriver was launched at Google.

> In 2008, the whole Selenium squad decided to merge Selenium RC amongst Selenium WebDriver
in corporation to assort to a greater extent than powerful tool called Selenium 2.0

Selenium 1.0 + Selenium WebDriver = Selenium 2.0

Selenium 1.0

Selenium IDE + Selenium RC + Selenium Grid

Selenium 2.0

Selenium IDE + Selenium RC + Selenium WebDriver + Selenium Grid

Note: Now Selenium RC is alone for maintenance Projects
----------------------------------------------
Selenium WebDriver Features:

> Selenium WebDriver doesn't get got IDE (Integrated Development Environment), alone Programming Interface

> Using Element Locators together with WebDriver Commands nosotros practise Test Cases

Element / Object    Locator / Property    Value
--------------------------------------------------------
Dog                       color                      black
                            height                    thirty
--------------------------------------------------------
Edit box                  name                    Email

link                         linkText                Gmail
----------------------------------------------------------
> Selenium WebDriver supports diverse Operating Environments

MS Windows
Linux
Macintosh etc...

> Selenium WebDriver supports diverse Programming Environments to write Test Scripts/Programs.

Java
C#
Perl
Python
Ruby
PHP

> Selenium WebDriver supports diverse Browsers

Mozilla Firefox

Google Chrome

IE

Safari

Opera etc...

> Selenium WebDriver supports diverse Testing Frameworks,

JNunit
TestNG
-----------------
NUnit

> It supports Batch Testing, Data Driven Testing, Database Testing together with Parallel Test execution
----------------------------------------------
Drawbacks of Selenium WebDriver
> Selenium WebDriver supports alone Web Applications

> It doesn't get got IDE, together with then creating Test Cases takes to a greater extent than fourth dimension together with efforts.

> No reliable Technical support.

> No built inwards Result Reporting facility.

> Limited back upward for Image Testing

> No other tool integration amongst Selenium WebDriver for Test Management
----------------------------------------------
ii) Selenium WebDriver Environment Setup

Steps:

1) Download together with Install Java Software (jdk) - To practise together with execute programs (Test Scripts)

2) Download Eclipse IDE together with Extract - Platform to write together with execute Java Programs.

3) Download Selenium WebDriver Java Language binding from www.seleniumhq.org together with Add  WebDriver jounce files to Java Project inwards Eclipse IDE.
---------------------------------------------------------
Download Browser drivers (Chrome, IE, safari etc...) to execute Test Cases using dissimilar browsers.
--------------------------------------------------------
You tin download together with Install Firebug together with Firepath plug ins for Firefox Browser to inspect elements,

Or
You tin purpose Firefox Browser built inwards characteristic "Page Inspector" to inspect elements

If nosotros purpose Chrome or IE, they get got built-in developer tools to inspect elements.
----------------------------------------------
WebDriver Environment Setup:

> Create Java Project
>Select Java Project inwards Eclipse IDE together with correct click
> Build path
> Configure construct path
> Select Libraries tab
> Click "External jars"
> Browse path of selenium Webdriver jars
> Add
----------------------------------------------
iii) Write kickoff Selenium Test Case

Test Scenario / Manual Test Case

Test Case Name: Verify Admin Login inwards gcrShop spider web portal

Test Steps:
1) Launch the Browser
2) Navigate to "http://www.gcrit.com/build3/admin/"
3) Enter Username
4) Enter Password
5) Click "Login" Button

Test Data:

Username = admin
Password = admin@123

Verification Point:
 

Capture the URL subsequently Login together with compare amongst expected.

Expected: http://www.gcrit.com/build3/admin/index.php

Actual:

Status: Pass/Fail
----------------------------------------------
Inspect Elements:
Username -Edit box- username (name locator value) - madhuri@gmail.com (Input data/Test Data)
 

Password -Edit box - password (name locator value) -
 

Login - Button - tdb1 (id locator value)
---------------------------
Element Locators - To identify/recognize/locate Elements
 

WebDriver Commands - To perform Operations on Elements
----------------------------------------------
Write Selenium WebDriver Test Case:

WebDriver driver = novel FirefoxDriver();
driver.get("http://www.gcrit.com/build3/admin/");
driver.findElement(By.name("username")).sendKeys("admin");
driver.findElement(By.name("password")).sendKeys("admin@123");
driver.findElement(By.id("tdb1")).click();

String url = driver.getCurrentUrl();

if (url.equals("http://www.gcrit.com/build3/admin/index.php")){
System.out.println("Admin Login Successful - Passed");
}
else {
System.out.println("Admin Login Unsuccessful - Failed");
}
driver.close();
}
}
----------------------------------------------
String url = driver.getCurrentUrl();
if (url.equals("http://www.gcrit.com/build3/admin/index.php")){
}

Or

if ((driver.getCurrentUrl()).equals("http://www.gcrit.com/build3/admin/index.php")){
}
----------------------------------------------
Keywords used inwards this Test Case:
driver / driver Object - Firefox Browser Driver

get - WebDriver Command
findElement - WebDriver Command
sendKeys -WebDriver Command
click - WebDriver Command
getCurrentUrl -WebDriver Command
close - WebDriver Command

By - Predifined Class

name - Element Locator
id - Element Locator

username - Element Locator Value
password- Element Locator Value
tdb1- Element Locator Value

admin - Input / Test Data
admin@123 - Input / Test Data

if - Java Conditional Statement

equals - Java String Method
----------------------------------------------

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post