SlideShare a Scribd company logo
1
Automated Testing
With Selenium
1
2
Agenda
1. Architecture of Selenium
2. Introduction to IDE, WebDriver and
Selenium Grid
3. Different Locator Technique
4. Invoke Different Browsers and logic behind
browsers
5. TestNG
6. Automate a LoginPage
7. QnA
2
Architecture of Selenium
3
JSON Wire Protocol
over HTTP
JSON Wire Protocol
over HTTP BrowserBrowser
Driver APIDriver API
C#C#
RubyRubyRubyRuby
JavaJava
PythonPython
Language Binding
OR
Selenium Client Library Real BrowsersReal Browsers
http request over
HTTP Server
http response to
HTTP Server
Selenium Server
IDE, WebDriver and Grid
Selenium IDE
• Selenium IDE is an integrated development environment for Selenium scripts. It is implemented
as a Chrome and Firefox extension, and allows you to record, edit, and debug tests.
• This is basically record and play
• Recorded script can be exported in different languages.
• This extension is available for Chrome and Mozilla
4
SeleniumWebDriver
• WebDriver is one of the most powerful and popular tools of Selenium Family.
• WebDriver extends its support to many latest browsers and platforms
• WebDriver makes direct calls to the Web browser and the entire test script is executed in this
fashion. WebDriver uses the browsers support and capabilities to automation.
• It drives the browser much more effectively
Selenium Grid
• Selenium Grid is a part of the Selenium Suite that enable in running multiple tests across different
browsers, in different OS and in different Machines.
• This will assures us that the application is fully compatible to different browsers running on
different OS
• It reduces the time to test application on diversified environment.
5
IDE, WebDriver and Grid cont..
Setup the Environment in Eclipse
• Download Selenium server from selenium official portal seleniumhq.org
• Download selenium language binding (Java we will be using here)
• Download Chrome Browser executable file (https://chromedriver.storage.googleapis.com/index.html?path=2.41/)
• Start Eclipse and Create a Java Project.
• Add the downloaded JAR to this project (Selenium Server Jar and Java language jar)
6
Launch the browser
public class LaunchBrowsers {
public WebDriver driver;
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", “C:chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("https://google.com");
7
Program and logics behind it
public class LaunchBrowsers {
public WebDriver driver;
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", “C:chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("https://google.com");
Let’s understand the Browser behavior and the logic behind it.
TestNG
• TestNG is a testing framework
• This is an open source testing framework, TestNG has NG, which means Next Generation
• TestNG is derived after JUnit and it is much more powerful than JUnit
• TestNG enables us to write Business logic, Step by Step test, write information about Test,
Prioirtize the Testing Methods and Testing functionalities.
• There are many annotations used on TestNG like - @BeforeTest, @AfterTest, @BeforeClass,
@Test
Install TestNG in Eclipse
• Eclipse >> Help >> install New Software >> Name: TestNG” and type “http://beust.com/eclipse/”
as location.
8
TestNG : How it works
• Selenium works on Web automation through action performed on Web Component –
which is called as “Locators”
• We use these locators in our test script and while execution selenium server performs
action on these locators – which is called as “Web Elements”
• In Selenium there are 8 ways to locate these element
1.By xpath
2.By ID
3.By Name
4.By Link Text
5.By Partial Link Text
6.By Class Name
7.By CSS
8.By Tag Name
9
Locator Technique in Selenium
Demo and Practical on Locators on Real Website
Let’s launch the demo portal and locate the elements:
10
11
12

More Related Content

PPT
Selenium using C# by Yogesh Kumar
PPTX
Selenium
PPTX
Automation - web testing with selenium
DOCX
Selenium WebDriver FAQ's
ODP
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
PDF
Selenium IDE Introduction, Installation and Working
PPT
selenium training | selenium course | selenium video tutorial | selenium for ...
Selenium using C# by Yogesh Kumar
Selenium
Automation - web testing with selenium
Selenium WebDriver FAQ's
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Selenium IDE Introduction, Installation and Working
selenium training | selenium course | selenium video tutorial | selenium for ...

What's hot (20)

ODP
Automated UI testing with Selenium
PDF
Testing Code.org's Interactive CS Curriculum
PDF
Basics of Selenium IDE,Core, Remote Control
PPTX
BDD using Cucumber JVM
PPTX
Selenium topic 4 - Selenium Web Driver Set Up
PPTX
Get Started With Selenium 3 and Selenium 3 Grid
PPTX
Selenium Topic 2 IDE
ODP
Mastering selenium for automated acceptance tests
PPT
Testing Java Web Apps With Selenium
PPT
Introduction to Eclipse IDE
PPTX
Selenium Webdriver
PDF
Selenium Basics Tutorial
PPTX
Selenium Automation
PPT
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
PPTX
#2 integration + ui tests
PDF
Session on Selenium Powertools by Unmesh Gundecha
PDF
Introduction to Selenium Webdriver - SpringPeople
PDF
Selenium 2 for PHP(Unit)
 
PPTX
Smarter ways to do selenium automation @ work, Selenium, automation
KEY
Testing with Jenkins, Selenium and Continuous Deployment
Automated UI testing with Selenium
Testing Code.org's Interactive CS Curriculum
Basics of Selenium IDE,Core, Remote Control
BDD using Cucumber JVM
Selenium topic 4 - Selenium Web Driver Set Up
Get Started With Selenium 3 and Selenium 3 Grid
Selenium Topic 2 IDE
Mastering selenium for automated acceptance tests
Testing Java Web Apps With Selenium
Introduction to Eclipse IDE
Selenium Webdriver
Selenium Basics Tutorial
Selenium Automation
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
#2 integration + ui tests
Session on Selenium Powertools by Unmesh Gundecha
Introduction to Selenium Webdriver - SpringPeople
Selenium 2 for PHP(Unit)
 
Smarter ways to do selenium automation @ work, Selenium, automation
Testing with Jenkins, Selenium and Continuous Deployment
Ad

Similar to Selenium Java for Beginners by Sujit Pathak (20)

PPTX
Selenium presentation
PDF
Selenium for Tester.pdf
PPTX
Selenium.pptx
PDF
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
PPTX
Basics of selenium containing features of selenium
PDF
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
PPTX
Selenium 101 Webinar
PPTX
seldmskksnnisjals, sjnsjjs dsajdjsadsdjsnsjn.pptx
PPTX
Introduction to the Selenium_Session1.pptx
PDF
Deep Dive Into NightWatch- Workshop by Pallavi Sharma.pdf
PPTX
ODP
eXo Platform SEA - Play Framework Introduction
PPTX
Test Automation Using Selenium
PPTX
Session 01 - Introduction to Selenium - Part 2
PPTX
Selenium.pptx
PPTX
Selenium Introduction and IDE
PPTX
Automated ui-testing
PPTX
Selenium web driver
PPTX
Selenium Basics and Overview topics.pptx
PPTX
Selenium Basics and Overview1233444.pptx
Selenium presentation
Selenium for Tester.pdf
Selenium.pptx
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Basics of selenium containing features of selenium
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Selenium 101 Webinar
seldmskksnnisjals, sjnsjjs dsajdjsadsdjsnsjn.pptx
Introduction to the Selenium_Session1.pptx
Deep Dive Into NightWatch- Workshop by Pallavi Sharma.pdf
eXo Platform SEA - Play Framework Introduction
Test Automation Using Selenium
Session 01 - Introduction to Selenium - Part 2
Selenium.pptx
Selenium Introduction and IDE
Automated ui-testing
Selenium web driver
Selenium Basics and Overview topics.pptx
Selenium Basics and Overview1233444.pptx
Ad

More from Software Testing Board (11)

PPT
Software Testing Board meetup 24th-Nov-2018
PDF
Manage Selenium Grid with Terraform by Omkar Khatavkar (https://www.linkedin....
PPTX
Introduction to Selenium Python by Kishore
PPTX
Shell scripting to test volume of SEO pages with ease by Abdul Hadi
PPTX
BRD document for test automation estimation
PPTX
Micro Service automation by Srijit Jain
PDF
Docker with Selenium by Thirumalai Vignesh
PDF
A testers survival guide for agile transition by Parveen Sultana
PDF
Shift left shift-right performance testing for superior end-user by Arun Dutta
PPT
Software Testing Board's start-here guide for the Question and Answer site
PDF
Agile Testing by ShriKant Vashishtha
Software Testing Board meetup 24th-Nov-2018
Manage Selenium Grid with Terraform by Omkar Khatavkar (https://www.linkedin....
Introduction to Selenium Python by Kishore
Shell scripting to test volume of SEO pages with ease by Abdul Hadi
BRD document for test automation estimation
Micro Service automation by Srijit Jain
Docker with Selenium by Thirumalai Vignesh
A testers survival guide for agile transition by Parveen Sultana
Shift left shift-right performance testing for superior end-user by Arun Dutta
Software Testing Board's start-here guide for the Question and Answer site
Agile Testing by ShriKant Vashishtha

Recently uploaded (20)

PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Lesson notes of climatology university.
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
master seminar digital applications in india
PPTX
Cell Structure & Organelles in detailed.
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Complications of Minimal Access Surgery at WLH
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
01-Introduction-to-Information-Management.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Presentation on HIE in infants and its manifestations
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Lesson notes of climatology university.
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
master seminar digital applications in india
Cell Structure & Organelles in detailed.
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Complications of Minimal Access Surgery at WLH
A systematic review of self-coping strategies used by university students to ...
O5-L3 Freight Transport Ops (International) V1.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
01-Introduction-to-Information-Management.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
GDM (1) (1).pptx small presentation for students
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Presentation on HIE in infants and its manifestations
Module 4: Burden of Disease Tutorial Slides S2 2025

Selenium Java for Beginners by Sujit Pathak

  • 2. 2 Agenda 1. Architecture of Selenium 2. Introduction to IDE, WebDriver and Selenium Grid 3. Different Locator Technique 4. Invoke Different Browsers and logic behind browsers 5. TestNG 6. Automate a LoginPage 7. QnA 2
  • 3. Architecture of Selenium 3 JSON Wire Protocol over HTTP JSON Wire Protocol over HTTP BrowserBrowser Driver APIDriver API C#C# RubyRubyRubyRuby JavaJava PythonPython Language Binding OR Selenium Client Library Real BrowsersReal Browsers http request over HTTP Server http response to HTTP Server Selenium Server
  • 4. IDE, WebDriver and Grid Selenium IDE • Selenium IDE is an integrated development environment for Selenium scripts. It is implemented as a Chrome and Firefox extension, and allows you to record, edit, and debug tests. • This is basically record and play • Recorded script can be exported in different languages. • This extension is available for Chrome and Mozilla 4
  • 5. SeleniumWebDriver • WebDriver is one of the most powerful and popular tools of Selenium Family. • WebDriver extends its support to many latest browsers and platforms • WebDriver makes direct calls to the Web browser and the entire test script is executed in this fashion. WebDriver uses the browsers support and capabilities to automation. • It drives the browser much more effectively Selenium Grid • Selenium Grid is a part of the Selenium Suite that enable in running multiple tests across different browsers, in different OS and in different Machines. • This will assures us that the application is fully compatible to different browsers running on different OS • It reduces the time to test application on diversified environment. 5 IDE, WebDriver and Grid cont..
  • 6. Setup the Environment in Eclipse • Download Selenium server from selenium official portal seleniumhq.org • Download selenium language binding (Java we will be using here) • Download Chrome Browser executable file (https://chromedriver.storage.googleapis.com/index.html?path=2.41/) • Start Eclipse and Create a Java Project. • Add the downloaded JAR to this project (Selenium Server Jar and Java language jar) 6 Launch the browser public class LaunchBrowsers { public WebDriver driver; public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", “C:chromedriver.exe"); ChromeDriver driver = new ChromeDriver(); driver.get("https://google.com");
  • 7. 7 Program and logics behind it public class LaunchBrowsers { public WebDriver driver; public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", “C:chromedriver.exe"); ChromeDriver driver = new ChromeDriver(); driver.get("https://google.com"); Let’s understand the Browser behavior and the logic behind it.
  • 8. TestNG • TestNG is a testing framework • This is an open source testing framework, TestNG has NG, which means Next Generation • TestNG is derived after JUnit and it is much more powerful than JUnit • TestNG enables us to write Business logic, Step by Step test, write information about Test, Prioirtize the Testing Methods and Testing functionalities. • There are many annotations used on TestNG like - @BeforeTest, @AfterTest, @BeforeClass, @Test Install TestNG in Eclipse • Eclipse >> Help >> install New Software >> Name: TestNG” and type “http://beust.com/eclipse/” as location. 8 TestNG : How it works
  • 9. • Selenium works on Web automation through action performed on Web Component – which is called as “Locators” • We use these locators in our test script and while execution selenium server performs action on these locators – which is called as “Web Elements” • In Selenium there are 8 ways to locate these element 1.By xpath 2.By ID 3.By Name 4.By Link Text 5.By Partial Link Text 6.By Class Name 7.By CSS 8.By Tag Name 9 Locator Technique in Selenium
  • 10. Demo and Practical on Locators on Real Website Let’s launch the demo portal and locate the elements: 10
  • 11. 11
  • 12. 12

Editor's Notes

  • #3: Who we are Testing JS code and front-end Listing the types of tests Looking at some test tools Writing and running tests Testing without the browser What is a headless browser Scripting with a headless browser Testing with a headless browser Continuous Integration Deploying code Integrating testing with builds Review build results