60
AN OVERVIEW OF SELENIUM WEBDRIVER ANURAJ S.L Lead QA Engineer

An overview of selenium webdriver

Embed Size (px)

Citation preview

Page 1: An overview of selenium webdriver

AN OVERVIEWOF

SELENIUM WEBDRIVER

ANURAJ S.L Lead QA Engineer

Page 2: An overview of selenium webdriver

What is Selenium?

Page 3: An overview of selenium webdriver
Page 4: An overview of selenium webdriver

Is that what we are looking for ?

Page 5: An overview of selenium webdriver

What is Selenium?Selenium is a free (open source) automated testing suite for web applications across different browsers and platforms.

In short it automates browser. That’s it.

Page 6: An overview of selenium webdriver

SELENIUM AUTOMATES BROWSERS

ALL MAJOR BROWSERS

ON ALL MAJOR (DESKTOP) OPERATING SYSTEMS

Page 7: An overview of selenium webdriver

… AND MOBILE*

* Via Appium, Selendroid, ios-driver and WP driver.

Page 8: An overview of selenium webdriver

No Proprietary IDE / Language

Page 9: An overview of selenium webdriver

Who developed Selenium?

Page 10: An overview of selenium webdriver

Who developed Selenium?

Since Selenium is a collection of different tools, it had different developers as well. Some key contributorsJason HugginsPatrick LightbodyShinya Kasatani

Page 11: An overview of selenium webdriver

Why the name Selenium ?

Page 12: An overview of selenium webdriver

Why Selenium ?It came from a joke which Jason cracked one time to his team. Another automated testing framework was popular during Selenium's development, and it was by the company called Mercury Interactive (yes, the company who originally made QTP before it was acquired by HP). Since Selenium is a well-known antidote for Mercury poisoning, Jason suggested that name.

Page 13: An overview of selenium webdriver

Why Selenium ?The name, Selenium, was selected because selenium mineral supplements serve as a cure for mercury poisoning, Huggins explained.

Page 14: An overview of selenium webdriver

Why do we Automate ?

Page 15: An overview of selenium webdriver

Why do we Automate ?

Page 16: An overview of selenium webdriver

What do we do with Selenium ?

Page 17: An overview of selenium webdriver

Components of Selenium

It has mainly four components.

Selenium Integrated Development Environment (IDE)

Selenium Remote Control (RC) WebDriver Selenium Grid

Page 18: An overview of selenium webdriver

Selenium IDE

Components of Selenium

Page 19: An overview of selenium webdriver

Selenium IDE

PROS:

• No programming skills required• Easy record and playback• Step by step debugger• Play tests on any browser• Export tests as Webdriver tests• Extensible

CONS:

• Based on Selenium Core• No code reuse• No iterations and conditional

statements• No exception handling• No error recovery

A Firefox Add-on for recording, editing and running tests.Over 10M downloads to date!

Page 20: An overview of selenium webdriver

Selenium IDE

PROS:

• No programming skills required• Easy record and playback• Step by step debugger• Play tests on any browser• Export tests as Webdriver tests• Extensible

CONS:

• Based on Selenium Core• No code reuse• No iterations and conditional

statements• No exception handling• No error recovery

A Firefox Add-on for recording, editing and running tests.Over 10M downloads to date!

Page 21: An overview of selenium webdriver

Selenium RC

Components of Selenium

Page 22: An overview of selenium webdriver

Selenium RC

•You first need to launch a separate application called Selenium Remote Control (RC) Server.•The Selenium RC Server acts as a "middleman" between your Selenium commands and your browser.•When you begin testing, Selenium RC Server "injects" a Javascript program called Selenium Core into the browser. •Once injected, Selenium Core will start receiving instructions relayed by the RC Server from your test program. •When the instructions are received, Selenium Core will execute them as Javascript commands. •The browser will obey the instructions of Selenium Core, and will relay its response to the RC Server. •The RC Server will receive the response of the browser and then display the results to you. •RC Server will fetch the next instruction from your test script to repeat the whole cycle .

Page 23: An overview of selenium webdriver

Selenium RC

Page 24: An overview of selenium webdriver

Selenium 2

Selenium

WebDriver

Selenium

Grid

Selenium

IDE

Browser Automation

APILocal + Remote

Centrally managed parallel execution

in diverse environments

A FF record-playback tool

mostly used for fast prototyping

Page 25: An overview of selenium webdriver

Selenium WebDriver

Components of Selenium

Page 26: An overview of selenium webdriver

What is WebDriver ?

Page 27: An overview of selenium webdriver

What is WebDriver ?WebDriver is a web automation framework that allows you to execute your tests against different browsers.

Page 28: An overview of selenium webdriver

IEDriverServer.exe

XPCOM

COM

WIRE (JSON /

HTTP)

WIRE (JSON / HTTP)w

ebdriver.xpi

Selenium WebDriver

Page 29: An overview of selenium webdriver

What is WebDriver ?

Have you really understood What actually is WebDriver?

Page 30: An overview of selenium webdriver

What is WebDriver ?

The official site says that:

“WebDriver is a tool for automating web application testing, and in particular to verify that they work as expected.

It aims to provide a friendly API that’s easy to explore and understand, easier to use than the Selenium-RC (1.0) API, which will help to make your tests easier to read and maintain.

It’s not tied to any particular test framework, so it can be used equally well in a unit testing or from a plain old “main” method.”

Page 31: An overview of selenium webdriver

What is WebDriver ?

Generally there might have questions about this definition.What is a framework?

What is an API?

How does Selenium RC works?

What is unit testing ?

Too many questions instead of an answer

Page 32: An overview of selenium webdriver

What is WebDriver ?

Is there an easier way of understanding what WebDriver test automation is? 

Page 33: An overview of selenium webdriver

What is WebDriver ?

Can test automation with Selenium WebDriver be explained in very simple terms so that everyone can understand it, even without having any technical knowledge?

An easy way of explaining how a new thing is through an analogy with something else that you already know.

Page 34: An overview of selenium webdriver

WebDriver test automation is like driving a taxi !!!

What is WebDriver ?

Page 35: An overview of selenium webdriver

WebDriver test automation is like driving a taxi !!!

What is WebDriver ?

REALLY ????

Page 36: An overview of selenium webdriver

What is WebDriver ?

The WebDriver points to the analogy.

Everyone knows what a driver is and what he does.

Many people drive a car.

Those who don't drive a car use the services of taxi drivers.

Page 37: An overview of selenium webdriver

What is WebDriver ?

Who participates in taxi driving?

3 actors are involved: 

1. The customer2. The taxi driver3. The car

Page 38: An overview of selenium webdriver

What is WebDriver ?

What happens while driving a taxi?

Dialogues between the 3 actors involved.

Page 39: An overview of selenium webdriver

So this is the analogy used to explain test

automation with WebDriver.

What is WebDriver ?

Test automation with WebDriver is like driving a taxi.

It happens through dialogues between the 3 actors involved.

Page 40: An overview of selenium webdriver

What is WebDriver ?

Lets have a closer look at taxi driving.

A customer gets into a cab.

He gives instructions to the taxi driver about  1) the address and  2) the route to take

Page 41: An overview of selenium webdriver

What is WebDriver ?

Now the cab driver drives the taxi, the car in this case.

While driving the taxi, the driver gives commands to the car using the wheel, pedals, etc.

Page 42: An overview of selenium webdriver

What is WebDriver ?

The driver receives information about the cab’s status on the meters and makes decisions based on it.

The car executes the taxi driver commands to get to the desired address.

Page 43: An overview of selenium webdriver

How does this help with understanding test automation ?

What is WebDriver ?

Page 44: An overview of selenium webdriver

What is WebDriver ?

Let's ask about test automation the same questions asked for driving a taxi.

Who participates in test automation?

There are 3 actors in test automation with WebDriver:

1. tester that writes the automation code2. browser driver3. browser

Page 45: An overview of selenium webdriver

What is WebDriver ?

What happens during test automation?

Dialogue between the 3 actors involved.

Page 46: An overview of selenium webdriver

How do the analogy between taxi driving and web driver

test automation work?

What is WebDriver ?

Page 47: An overview of selenium webdriver

How do the analogy between taxi driving and web driver

test automation work?

What is WebDriver ?

Let's see:

A test engineer is like a taxi customer.

The test automation code is like the customer instructions to the taxi driver.

The browser driver object is like the taxi driver.

The browser is like a car.

Page 48: An overview of selenium webdriver

Does it start making sense?

Taxi driving versus test automation?

What is WebDriver ?

Page 49: An overview of selenium webdriver

What is WebDriver ?

Let's have a closer look at test automation.

The test engineer writes code with instructions for the browser driver object.

He tells the browser driver object to 

1) open the site and 2) interact with the site elements.

Page 50: An overview of selenium webdriver

What is WebDriver ?

The browser driver drives the browser.

It does this by sending commands to the browser.

Page 51: An overview of selenium webdriver

What is WebDriver ?

The browser driver receives information from the browser about 

• status of site elements (are they visible, are they enabled)

• values of site elements and makes decisions based on it.

The browser executes the commands received from the browser driver.

Page 52: An overview of selenium webdriver

Is the analogy clear now?

What is WebDriver ?

Page 53: An overview of selenium webdriver

WebDriver Vs Selenium RC

Both WebDriver and Selenium RC have following features:

They both allow you to use a programming language in designing your test scripts.

They both allow you to run your tests against different browsers.

So how do they differ ?

Page 54: An overview of selenium webdriver

WebDriver Vs Selenium RC

Architecture : WebDriver's architecture is simpler than Selenium RC's.

It controls the browser from the OS level. All you need are your programming language's IDE (which contains your Selenium commands) and a browser.

Page 55: An overview of selenium webdriver

WebDriver Vs Selenium RC

Speed:

Page 56: An overview of selenium webdriver

WebDriver Vs Selenium RC

Real-life Interaction:

Page 57: An overview of selenium webdriver

WebDriver Vs Selenium RC

Page 58: An overview of selenium webdriver

WebDriver Vs Selenium RC

Page 59: An overview of selenium webdriver

References

Guru 99 - http://www.guru99.com Test-able Blog - http://test-able.blogspot.in

Page 60: An overview of selenium webdriver

THANK YOU !!!

Thank You !!!