SlideShare a Scribd company logo
1 of 29
Overview of Selenium
Selenium is a set of tools for automating testing activities of web application.
Selenium is highly flexible, allowing many options for locating UI elements and
comparing expected test results against actual application behavior. We can execute
one test in multiple machines.
Selenium Components
Selenium is divided into following major tools.
• Selenium IDE
• Selenium RC
• Selenium webdriver
• Selenium Grid
Selenium-IDE
Selenium is a web automation tool.It is a firefox plugin. It is a record and
playback tool.It will record the scripts automatically based on user's action on a
site.After the recording the tester needs to make small changes in the script based on
the testing flow.It allows to record, edit and debug the generated scripts.
By using this IDE we can create browser based regression test suit. Selenium
IDE provides option to set breakpoint.We can set breakpoint from which line to
which line we need to run.We use selenium IDE for web automation, it helps us to
test field level validation, for example in contact us page if contact no is given then
clicking the submit button, the warning message will appear for contact no is
mandatory then we can capture the warning message using selenium IDE. After
capturing the warning message we execute the script for regression it finds whether
the warning comes or not.
Disadvantage
Selenium IDE works only on firefox plugin. For supporting multiple browsers,
we can move to Selenium RC.
Selenium-RC (Remote Control)
Selenium-RC supports multiple browser environment.It also allows to use a highlevel
programming language for maximum flexibility and extensibility in developing test logic. We can
execute the generated testscript from selenium IDE and export it into java, Ruby to any other
language, import the script in eclipse IDE.By using eclipse IDE we can enhance the testscript.
Selenium-RC provides an API (Application Programming Interface) and library for each of its
supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. Selenium-RC supports high-
level programming languages to develop automation test cases.
Disadvantage
Currently Selenium RC is not used. Because it doesnt support the latest android
technologies. To overcome this we are moving to web driver.
Selenium Web driver
It has a lot of new features. It supports latest android technologies. It doesn't require the
knowledge of RC. It interacts with html of the application as a real user.It allows to integrate with
Junit, TestNG.It handles the Javascript alerts, prompts and handling multiple frames, multiple
browser windows. Selenium-WebDriver supports multi browsers multi OS, it uses browser’s native
support for automation to make direct calls to the browser. The WebDriver supports multiple
browser like FirefoxDriver, ChromeDriver, InternetExplorerDriver, SafariDriver etc. The direct
calls are made to each browser is depends on which browser you are using.
Selenium-Grid
Selenium-Grid allows the Selenium-RC solution to scale for large test suites or test suites
that must be run in multiple environments. With Selenium-Grid, multiple instances of Selenium-RC
are running on various operating system and browser configurations; Each of these when launching
register with a hub. When tests are sent to the hub they are then redirected to an available Selenium-
RC, which will launch the browser and run the test. This allows for running tests in parallel, with
the entire test suite theoretically taking only as long to run as the longest individual test.
Download Selenium
From the below link you can download the latest selenium components.
http://seleniumhq.org/download/
How to install Selenium IDE?
Step 1: Open Mozilla Firefox
Step 2: Enter the link http://seleniumhq.org/download/ and click GO, webpage will be opened,
then Click on 'Download' link for the Selenium IDE project.
Step 3: While downloading it will ask for allow download, so Click ‘Allow’ button on the top-right
side to proceed with the installation
Step 4: Click on the 'Install Now' button, the downloading starts and after download completes it
ask for Restart Firefox
Step 5: click 'Restart Firefox' button
Step 6: After restart, Click Tools > Selenium IDE in the firefox
Step 7: It opens the new Selenium IDE record/playback window.
Selenium IDE Tool
Selenium Concepts
Selenium scripts were generated in the form of
• command
• target
• value
Selenium IDE¶
Selenium IDE Tools
How to record in Selenium IDE?
1. Open Firefox browser.
2. Click on Tools > Selenium IDE, Selenium IDE window will be opened.
3. Enter the application URL in the firefox browser and press enter, parallelly the Selenium IDE is
still in open.
4. Click on the red icon in the top right of the Selenium IDE to record the actions.
5. After clicking the red icon, minimize the Selenium IDE window and start working on the
application. All the actions which you performed in the application are recorded in Selenium IDE in
the form of script.
6. After you complete all the recording actions, Click the same red icon again (now it is recording
mode) to stop recording.
7. To playback the recorded scripts, click on the green icon('Play entire test suite') which is in the
top left of the window.
8. After clicking the green icon, the test scripts will start execute (play back) line by line. The
resluts are shown in the Log which in the bottom site of the window.
Selenium WebDriver
Selenium 2.0 - is a tool for automated functional testing, which includes two previously
independent projects - Selenium Remote Control (Selenium RC) and webDriver (Selenium WD).
Selenium 2.0 allows you to use all the tools like Selenium WebDriver, and Selenium RC. Selenium
developers recommend to use Selenium webDriver, as Selenium RC was officially deprecated.
While working at Selenium 2.0 they mainly developed Selenium WebDriver and its compatibility
with Selenium RC. Selenium RC itself was not changed much.
There is a number of WebDrivers for the major browsers in the moment, which are in
different readiness stages:
• FirefoxDriver (3.0, 3.5, 3.6, 4.0, 5.0, 6, 7, 8, 9, 10 and beginning with ver. 2.15 partially 11)
• InternetExplorerDriver (6, 7, 8, 9 - 32 and 64-bit where applicable)
• ChromeDriver (12.0.7, 12.0 +); OperaDriver (11.5 +)
• OperaDriver (11.5 +)
• SafariDriver - currently is not available
• HtmlUnitDriver (2.9), cross-platform driver on java, no need to install any browser
• AndriodDriver (2.3 + for phones and tablets (devices & emulators) IphoneDriver)
• iOS 3 + for phones (devices & emulators) and 3.2 + for tablets (devices & emulators)
Languages (bindings) officially supported in Selenium WebDriver are:
C #
Java
Ruby
Python
Features of Web driver
No need to start server prior to start executing scripts.
• It allows to simulate the mouse movements.
• It provides the improved reliability between browsers.
• A most awaiting feature added in WebDriver is “Implementation of listeners”.
• For web application testing, it provides standard programming interface.
• It allows to simulate keyboard key press events using different classes.
• It allows to simulate the clicking of browser front and back button.
• Added advantage to support for iPhone and Android testing
• It os similar to QTP, It allows to extract the objects in bulk. In RC this is big pain to
extracting the objects.
• It supports features like Page navigation, Drag-and-drop and AJAX-based UI elements.
• Using WebDriver can easily find the coordinates of any object.
• WebDriver is open source & it allows you to easily integrate with testing framework like
JUnit or TestNG.
Now we will see the demo how selenium web driver works
Run a simple test script in Selenium Webdriver with TestNG
Step 1 : Record selenium automation script using Selenium IDE.
Step 2: Export the recorded selenium automation script as a Java / JUnit 4 / Webdriver. Eg. Here
we export a java as “Login.java”
a)Export as java file
b) Save the exported java file
Step 3: Create a New java project in eclipse and import the java file which was exported in the
previous step.
Go to File -> New -> Project
Select new project as java project
Enter the project name
Click finish
Create a new package
Enter the project name.
Right the package and select import option.
Import from directory
Select the java file
After import the java file will been seen with error since the classpath not set for selenium webdriver
jars.
Step 4 : Download Selenium 2 Web Driver from http://seleniumhq.org/download/
You will get the folder in your download path and keep it there and unzip it so that you can use it
in later steps. The files in the folder should look something like this :
Step 5: Add External Files (Referenced Libraries ) in to the Eclipse.
a. Right Click the project and go to Properties.
b. Go to Java Build Path -> Library tab -> Add External JARs…
c. Now add all the jar files
d. Check if they are appearing in the Eclipse as below.
e. After configure the classpath the error will be cleared automatically.
Step 6: Install TestNG Plug-in in Eclipse.
In Eclipse, go to Help -> Install New Software
Enter http://beust.com/eclipse in the Work with: field
Wait and TestNG will be appeared in the window. Check the box next to TestNG and Click on Next button. Click on
Finish and the Restart the Eclipse.
Step 7: Change the Junit code to TestNG code.(Exported Login.java)
Change the annotation from Junit code to TestNG.
Eg. @Before replace with @BeforeTest
@After replace with @AfterTest
Remove the Junit import header and replace with appropriate TestNG import header .
Eg., import org.junit.*; replace with import org.testng.*; and
import org.testng.annotations.*;
• If any junit code is used in then replace with appropriate TestNG code.
• verifyTextPresent in a field may require manual changes
Eg.
try {
assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[sS]*Homern
rn[sS]*$"));
} catch (Error e) {
verificationErrors.append(e.toString());
}
replace with
try {
assertEquals(“Home”,driver.findElement(By.id("WindowName")).getText());
} catch (Error e) {
verificationErrors.append(e.toString());
}
Step 7 : Run the selenium automation script by right the java file and Run as-> TestNG Test.
Step 8 : Verify the test results in the console.
Note: In the exported Java from selenium IDE require manual changes to run the script in
eclipse.

More Related Content

What's hot

Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverPankaj Biswas
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing ToolZeba Tahseen
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorialprad_123
 
Selenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsSelenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsJai Singh
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answersITeLearn
 
How to configure Appium with android IDE & eclipse
How to configure Appium with android IDE & eclipseHow to configure Appium with android IDE & eclipse
How to configure Appium with android IDE & eclipseHaitham Refaat
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Seleniumvivek_prahlad
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - IntroductionSachin-QA
 
Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch  Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch Haitham Refaat
 

What's hot (19)

Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing Tool
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorial
 
Selenium
SeleniumSelenium
Selenium
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Selenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsSelenium Webdriver Interview Questions
Selenium Webdriver Interview Questions
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answers
 
How to configure Appium with android IDE & eclipse
How to configure Appium with android IDE & eclipseHow to configure Appium with android IDE & eclipse
How to configure Appium with android IDE & eclipse
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
Selenium topic 1- Selenium Basic
Selenium topic 1-  Selenium BasicSelenium topic 1-  Selenium Basic
Selenium topic 1- Selenium Basic
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium Primer
Selenium PrimerSelenium Primer
Selenium Primer
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - Introduction
 
Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch  Step by step - Selenium 3 web-driver - From Scratch
Step by step - Selenium 3 web-driver - From Scratch
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 

Similar to Selenium

Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium Rohit Thakur
 
Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVAmahirayavarapu
 
Test Automation Using Selenium
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using SeleniumNikhil Kapoor
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin MishraPravin Mishra
 
Basics of Selenium IDE,Core, Remote Control
Basics of Selenium IDE,Core, Remote ControlBasics of Selenium IDE,Core, Remote Control
Basics of Selenium IDE,Core, Remote Controlusha kannappan
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introductionPankaj Dubey
 
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsSelenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsQUONTRASOLUTIONS
 
Python selenium
Python seleniumPython selenium
Python seleniumDucat
 
What is Selenium Introduction to Selenium Testing.pptx
What is Selenium Introduction to Selenium Testing.pptxWhat is Selenium Introduction to Selenium Testing.pptx
What is Selenium Introduction to Selenium Testing.pptxSyntax Technologies
 
Selenium with testng and eclipse ide
Selenium with testng and eclipse ideSelenium with testng and eclipse ide
Selenium with testng and eclipse ideTestertester Jaipur
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rcDang Nguyen
 
Learn Selenium - Online Guide
Learn Selenium - Online GuideLearn Selenium - Online Guide
Learn Selenium - Online Guidebigspire
 
automation with python and selenium
automation with python and seleniumautomation with python and selenium
automation with python and seleniumManish Kumar
 

Similar to Selenium (20)

Selenium
SeleniumSelenium
Selenium
 
BCS Selenium Workshop
BCS Selenium WorkshopBCS Selenium Workshop
BCS Selenium Workshop
 
Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium
 
Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVA
 
Test Automation Using Selenium
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using Selenium
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin Mishra
 
Basics of Selenium IDE,Core, Remote Control
Basics of Selenium IDE,Core, Remote ControlBasics of Selenium IDE,Core, Remote Control
Basics of Selenium IDE,Core, Remote Control
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introduction
 
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsSelenium Basics by Quontra Solutions
Selenium Basics by Quontra Solutions
 
Sel
SelSel
Sel
 
Selenium using C# by Yogesh Kumar
Selenium using C# by  Yogesh KumarSelenium using C# by  Yogesh Kumar
Selenium using C# by Yogesh Kumar
 
Python selenium
Python seleniumPython selenium
Python selenium
 
What is Selenium Introduction to Selenium Testing.pptx
What is Selenium Introduction to Selenium Testing.pptxWhat is Selenium Introduction to Selenium Testing.pptx
What is Selenium Introduction to Selenium Testing.pptx
 
What is selenium
What is seleniumWhat is selenium
What is selenium
 
Selenium with testng and eclipse ide
Selenium with testng and eclipse ideSelenium with testng and eclipse ide
Selenium with testng and eclipse ide
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rc
 
Learn Selenium - Online Guide
Learn Selenium - Online GuideLearn Selenium - Online Guide
Learn Selenium - Online Guide
 
automation with python and selenium
automation with python and seleniumautomation with python and selenium
automation with python and selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium presentation
Selenium presentationSelenium presentation
Selenium presentation
 

Recently uploaded

INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 

Recently uploaded (20)

INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 

Selenium

  • 1. Overview of Selenium Selenium is a set of tools for automating testing activities of web application. Selenium is highly flexible, allowing many options for locating UI elements and comparing expected test results against actual application behavior. We can execute one test in multiple machines. Selenium Components Selenium is divided into following major tools. • Selenium IDE • Selenium RC • Selenium webdriver • Selenium Grid Selenium-IDE Selenium is a web automation tool.It is a firefox plugin. It is a record and playback tool.It will record the scripts automatically based on user's action on a site.After the recording the tester needs to make small changes in the script based on the testing flow.It allows to record, edit and debug the generated scripts. By using this IDE we can create browser based regression test suit. Selenium IDE provides option to set breakpoint.We can set breakpoint from which line to which line we need to run.We use selenium IDE for web automation, it helps us to test field level validation, for example in contact us page if contact no is given then clicking the submit button, the warning message will appear for contact no is mandatory then we can capture the warning message using selenium IDE. After capturing the warning message we execute the script for regression it finds whether the warning comes or not. Disadvantage Selenium IDE works only on firefox plugin. For supporting multiple browsers,
  • 2. we can move to Selenium RC. Selenium-RC (Remote Control) Selenium-RC supports multiple browser environment.It also allows to use a highlevel programming language for maximum flexibility and extensibility in developing test logic. We can execute the generated testscript from selenium IDE and export it into java, Ruby to any other language, import the script in eclipse IDE.By using eclipse IDE we can enhance the testscript. Selenium-RC provides an API (Application Programming Interface) and library for each of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. Selenium-RC supports high- level programming languages to develop automation test cases. Disadvantage Currently Selenium RC is not used. Because it doesnt support the latest android technologies. To overcome this we are moving to web driver. Selenium Web driver It has a lot of new features. It supports latest android technologies. It doesn't require the knowledge of RC. It interacts with html of the application as a real user.It allows to integrate with Junit, TestNG.It handles the Javascript alerts, prompts and handling multiple frames, multiple browser windows. Selenium-WebDriver supports multi browsers multi OS, it uses browser’s native support for automation to make direct calls to the browser. The WebDriver supports multiple browser like FirefoxDriver, ChromeDriver, InternetExplorerDriver, SafariDriver etc. The direct calls are made to each browser is depends on which browser you are using. Selenium-Grid Selenium-Grid allows the Selenium-RC solution to scale for large test suites or test suites that must be run in multiple environments. With Selenium-Grid, multiple instances of Selenium-RC are running on various operating system and browser configurations; Each of these when launching register with a hub. When tests are sent to the hub they are then redirected to an available Selenium- RC, which will launch the browser and run the test. This allows for running tests in parallel, with the entire test suite theoretically taking only as long to run as the longest individual test. Download Selenium From the below link you can download the latest selenium components. http://seleniumhq.org/download/
  • 3. How to install Selenium IDE? Step 1: Open Mozilla Firefox Step 2: Enter the link http://seleniumhq.org/download/ and click GO, webpage will be opened, then Click on 'Download' link for the Selenium IDE project. Step 3: While downloading it will ask for allow download, so Click ‘Allow’ button on the top-right side to proceed with the installation Step 4: Click on the 'Install Now' button, the downloading starts and after download completes it ask for Restart Firefox
  • 4. Step 5: click 'Restart Firefox' button Step 6: After restart, Click Tools > Selenium IDE in the firefox
  • 5. Step 7: It opens the new Selenium IDE record/playback window.
  • 6. Selenium IDE Tool Selenium Concepts Selenium scripts were generated in the form of • command • target • value
  • 8. Selenium IDE Tools How to record in Selenium IDE? 1. Open Firefox browser. 2. Click on Tools > Selenium IDE, Selenium IDE window will be opened. 3. Enter the application URL in the firefox browser and press enter, parallelly the Selenium IDE is still in open. 4. Click on the red icon in the top right of the Selenium IDE to record the actions. 5. After clicking the red icon, minimize the Selenium IDE window and start working on the application. All the actions which you performed in the application are recorded in Selenium IDE in the form of script. 6. After you complete all the recording actions, Click the same red icon again (now it is recording mode) to stop recording.
  • 9. 7. To playback the recorded scripts, click on the green icon('Play entire test suite') which is in the top left of the window. 8. After clicking the green icon, the test scripts will start execute (play back) line by line. The resluts are shown in the Log which in the bottom site of the window. Selenium WebDriver Selenium 2.0 - is a tool for automated functional testing, which includes two previously independent projects - Selenium Remote Control (Selenium RC) and webDriver (Selenium WD). Selenium 2.0 allows you to use all the tools like Selenium WebDriver, and Selenium RC. Selenium developers recommend to use Selenium webDriver, as Selenium RC was officially deprecated. While working at Selenium 2.0 they mainly developed Selenium WebDriver and its compatibility with Selenium RC. Selenium RC itself was not changed much. There is a number of WebDrivers for the major browsers in the moment, which are in different readiness stages: • FirefoxDriver (3.0, 3.5, 3.6, 4.0, 5.0, 6, 7, 8, 9, 10 and beginning with ver. 2.15 partially 11) • InternetExplorerDriver (6, 7, 8, 9 - 32 and 64-bit where applicable) • ChromeDriver (12.0.7, 12.0 +); OperaDriver (11.5 +) • OperaDriver (11.5 +) • SafariDriver - currently is not available • HtmlUnitDriver (2.9), cross-platform driver on java, no need to install any browser • AndriodDriver (2.3 + for phones and tablets (devices & emulators) IphoneDriver) • iOS 3 + for phones (devices & emulators) and 3.2 + for tablets (devices & emulators) Languages (bindings) officially supported in Selenium WebDriver are: C # Java Ruby Python
  • 10. Features of Web driver No need to start server prior to start executing scripts. • It allows to simulate the mouse movements. • It provides the improved reliability between browsers. • A most awaiting feature added in WebDriver is “Implementation of listeners”. • For web application testing, it provides standard programming interface. • It allows to simulate keyboard key press events using different classes. • It allows to simulate the clicking of browser front and back button. • Added advantage to support for iPhone and Android testing • It os similar to QTP, It allows to extract the objects in bulk. In RC this is big pain to extracting the objects. • It supports features like Page navigation, Drag-and-drop and AJAX-based UI elements. • Using WebDriver can easily find the coordinates of any object. • WebDriver is open source & it allows you to easily integrate with testing framework like JUnit or TestNG. Now we will see the demo how selenium web driver works
  • 11. Run a simple test script in Selenium Webdriver with TestNG Step 1 : Record selenium automation script using Selenium IDE. Step 2: Export the recorded selenium automation script as a Java / JUnit 4 / Webdriver. Eg. Here we export a java as “Login.java” a)Export as java file
  • 12. b) Save the exported java file
  • 13. Step 3: Create a New java project in eclipse and import the java file which was exported in the previous step. Go to File -> New -> Project
  • 14. Select new project as java project
  • 17. Create a new package
  • 19. Right the package and select import option.
  • 22. After import the java file will been seen with error since the classpath not set for selenium webdriver jars.
  • 23. Step 4 : Download Selenium 2 Web Driver from http://seleniumhq.org/download/
  • 24. You will get the folder in your download path and keep it there and unzip it so that you can use it in later steps. The files in the folder should look something like this :
  • 25. Step 5: Add External Files (Referenced Libraries ) in to the Eclipse. a. Right Click the project and go to Properties. b. Go to Java Build Path -> Library tab -> Add External JARs… c. Now add all the jar files d. Check if they are appearing in the Eclipse as below.
  • 26.
  • 27. e. After configure the classpath the error will be cleared automatically. Step 6: Install TestNG Plug-in in Eclipse. In Eclipse, go to Help -> Install New Software Enter http://beust.com/eclipse in the Work with: field Wait and TestNG will be appeared in the window. Check the box next to TestNG and Click on Next button. Click on Finish and the Restart the Eclipse. Step 7: Change the Junit code to TestNG code.(Exported Login.java) Change the annotation from Junit code to TestNG. Eg. @Before replace with @BeforeTest @After replace with @AfterTest Remove the Junit import header and replace with appropriate TestNG import header . Eg., import org.junit.*; replace with import org.testng.*; and import org.testng.annotations.*;
  • 28. • If any junit code is used in then replace with appropriate TestNG code. • verifyTextPresent in a field may require manual changes Eg. try { assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[sS]*Homern rn[sS]*$")); } catch (Error e) { verificationErrors.append(e.toString()); } replace with try { assertEquals(“Home”,driver.findElement(By.id("WindowName")).getText()); } catch (Error e) { verificationErrors.append(e.toString()); } Step 7 : Run the selenium automation script by right the java file and Run as-> TestNG Test. Step 8 : Verify the test results in the console.
  • 29. Note: In the exported Java from selenium IDE require manual changes to run the script in eclipse.