Professional Documents
Culture Documents
CONTENTS
1.What is Framework ?
2.Framework Architecture
3.Hybrid Framework
4.Difference b/w Common & Test Data
5.Generic Libraries
6.POM(Object Repository)
7.TestNG
8.Exceptions
9.Oops concept used in Framework
What is Framework ?
Framework is a collection of reusable
components that makes automation
development and modification easier and
faster.
It is a set of instruction followed by every
1.Java Utilities: Java Utility is one class in generic component, which contain java
specific methods which can be used across the test Scripts / Application
its contains several generic reusable methods like:-
getRandomNum() : It is used to generate random number for every invocation
in our test scripts.
2.WebDriver Utilities: Webdriver Utility is a Generic class , which contains
web driver specific reusable actions like:-
a.)waitForPageToLoad() After every action it will wait for the next action to
perform
b.)waitForElement() used to wait for element to be clickable in GUI and
check for specific element for every 500milliSeconds
c.)select() used to select value from drop down based on text, index etc.
d.)accpertAlert() Used to switch to alert window and accept(click on ok
button.
e.)cancelAlert() Used to switch to alert window and dismiss(click on cancel
button)
3. Excel Utility: As per the rule of automation, data should not be hardcoded
within the test scripts, so that to get the data from external file like Excel
& .properties file
We go for Excel Utility & FileUtlityExcel Utility class is developed using apache
Poi libraries, which is used to read the data from Excel File Utility is used to
get the data from .properties file .the file extension of excel should be .xlsx.
is easy.
Reusing test scripts in different credential is
easy.
Re running the same test script multiple
Page refresh
Initialize address
Address changes
StaleElementException
Declaration
@FindBy(LocatorName=‘Locator variable’)
Private WebElement ComponentName;
Business Logic
Public void username()
{
ComponentName.action
}
Annotations in POM
All annotations are there in selenium
WebDriver.
@FindBy(one locator/one condition):-Used to
frequently.
Maintenance is easy, because all the elements we
libraries.
More Readability.
Test Script development is faster due to business lib.
Handle Stale Elements Exception
Stale Elements Exception
It’s one of selenium Exception , whenever web driver try to
identify an element , element was available in GUI, but at time
of performing an action on the elements element was not
recognized due to page got refreshed or elements may
become old or element not attached to page in such case we
get staleElementReferenceException.
class.
Better fit for Agile processes.
Support Auto heal feature.
Less complexity(Private access modifier).
What is Auto Healing(by using @FindAll) ?
JUNIT vs TestNG
Supports Supports
Annotation of TestNG
With the help of TestNG We can run multiples of test scripts at a time
without any manual intimation.
We can prioritize to test cases.
We have to use @Test instead of main method.
Without @Test , TestNG class will not be executed, @test annotation
method act like main method in testNG
We can give invocation count
We can use all annotations of TestNG in our base class.
It Generate report automatically.
We can do Parallel execution as well as cross browser execution.
We can use Assertions for validation purpose
We can re run failed test cases and took screenshot of failed test cases.
Group execution helps us to segregate the test scripts into regression,
smoke testing.
We can also test particular affect method using regional testing.
EXCEPTIONS
Exceptions occurs during run time while execution of test
scripts
It is a deviation in a normal flow.
1.NoSuchElementException :If element is not found it will throw
this exception.
2.TimeOutException :If element is not found it will throw this
exception.
3.SeassionNotcreatedException : If chrome browser is updated
we will get this exception.
4.NoAlertPresentException : when we try to click on both ok and
cancel button together then we will get this exception.
5.NoSuchWindowException : This exception occurs if the window
target to be switch does not exist. it occurred when tried to
switch back from parent to child window.
6.InvalidArgumentException : It occurs when an argument
does not belong to the expected type.(passing int to
String or vice versa found while using data provider).
7.NullPointException : this exception occurs when the
application try to use an object reference which has a null
value.
8.Unknown host exception :Mostly due to chrome driver
executable issues was resolved either by closing all the
running chrome sessions.
9. elementnotinteractableexception : Thrown to indicate
that although a WebElement is present on the DOM, it is
not in a state that can be interacted with. This includes an
element that is not displayed or whose center point can
not be scrolled into the viewport.
OOPS Concept used in my Framework