SlideShare a Scribd company logo
Selenium
● Selenium is opensource Web Automation Tool
● It is a tool which is helping to run the scripts using any
programming language i.e. Java, Python, Ruby, C#, Java Scripts
Etc.
● Advantages Of Selenium
● It is Open Source (Source Code is Visible to All)
● It is Free of Cost
● Compatibility is possible
● It is Cross Platform tool.
● Limitations of Selenium?
● It Doesn’t Support Window Bases Application Directly need third
party tool to be integrated.
● We Can not Automate Desktop Bases Applications.
● We Cannot Automate Captcha.
● We Cannot Automate Barcode.
● We Cannot Automate File Uploading.
● We Cannot Automate Ad hoc testcases.
Note: Selenium Community Developed Specific Tool Called Appium to Automate
Windows Based Applications.
Selenium Community Also Developed Tools To Test Mobile Applications
1. Selendroid – It Supports only Android Platform
2. Appium- It Supports Android Platform, MAC, Windows.
Note: All Selenium related resources and documents can be found on the below
website
http://www.seleniumhq.org/
· Why Selenium is so Popular and
Demanding?
Table of Contents
​ · Why Selenium is so Popular and Demanding?
​ ·What Are the Different Flavor’s/Components of Selenium?
​ How Selenium Perform Automation Testing On Browser?
​ Architecture of Selenium
​ Why we Upcast the browser related child class to WebDriver and not
RemoteWebDriver class?
​ Where Did You Use Upcasting In Selenium?
​ Steps To Install /Integrate Selenium Server to the Java Project
​ Demonstration Program for Upcasting Concept(FirefoxDriver Class object
to WebDriver interface) and Accessing various methods of WebDriver
interface.
​ package Sample; import org.openqa.selenium.WebDriver; import
org.openqa.selenium.firefox.FirefoxDriver; public class
UpcastingToWebDriver_LaunchBrowser { public static void
main(String[] args) throws InterruptedException { //setting the path of
the gecko driver executable
System.setProperty("webdriver.gecko.driver",
".drivergeckodriver.exe"); //Launch the Firefox browser WebDriver
driver = new FirefoxDriver(); //Enter the url
driver.get("http://www.google.com"); //Get the title of the google page
and print it on the console String title = driver.getTitle();
System.out.println("the title of the page is :"+ title); //Get the URL of
the google page and print it on the console String currentUrl =
driver.getCurrentUrl(); System.out.println("the URL of the page is :"+
currentUrl); //Get the source code of the google page and print it on
the console String pageSource = driver.getPageSource();
System.out.println("the source code of the page is :"+ pageSource);
//Halt the program execution for 2 seconds Thread.sleep(2000); //
Close the browser driver.close(); }
​ FAQ’S
​ 1.What is Selenium Used For?
​ 2.What is Salary Of Selenium Tester?
​ 3.What are the Advantages of Selenium?
Selenium is so popular and demanding due to following features
1. It is an Opensource tool freely available on internet
2. No project cost involved
3. No license required
4. Can be easily customize to integrate with other Test management tools
like JIRA, ALM, Bugzilla etc.
5. It supports almost 13 different software languages
6. Java
7. C#
8. Python
9. Ruby
10. Perl
11.PHP
12. Java script
13. Haskell
14. R
15. Dart
16. TCL
17. Objective C
18. Java script (Node JS)
6)It Supports All the browsers (Firefox, Chrome, IE, etc.)
7)It Supports almost all the operating System (MAC, Window, Linux, etc.)
·What Are The Different
Flavor’s/Components Of Selenium?
1. Selenium Core – Developed by a company Called Thought Works way
back in 2004
2. Selenium IDE– Supports only Mozilla Firefox and supports record and
playback feature.
3. Selenium RC– Remote control version is 1.x used for parallel execution of
automation scripts on multiple remote system.
4. Selenium Webdriver– version is 2.x and 3.x and 4.x Compatibility is
possible in this and we can run the scripts in different languages as well.
Note: Selenium Web driver version 3.x is no longer capable of running Selenium
RC directly, rather it does through emulation and via an interface called
WebdriverBackedSelenium but it supports Selenium Grid Directly.
5.Selenium Grid – It is one of the components of selenium that is used to run
automation scripts on multiple system simultaneously.
It is used to carry out compatibility testing on multiple browsers and platform.
● What Are the Key /Important topic of Selenium?
● Automation framework- Guidelines and Rules to write selenium
code
● GitHub- Central Repository to store code
● Maven- Build dependency Tool for auto update of selenium version
● Selenium Grid- To test on multiple OS and browsers
● Jenkins- Continuous Integration
● TestNG- framework for generation of test reports and running
multiple test scripts in one go
1.
● What Are the Softwares required for Selenium?
● Eclipse IDE – Oxygen Stable Version
● JDK 1.8
● Selenium Server Standalone- 3.7.1(Stable version)
● From Where we have to download Selenium Eclipse Here it is the link
given below
http://www.seleniumhq.org/download
● Driver Executables
● For Firefox Browser
● The Name of driver executable – geckodriver.exe
● URL for download- https://github.com/mozilla/geckodriver/releases
● Version- 0.19 is recommended for Firefox browser with version
56.0 (selenium jar- 3.7.1)
● For Chrome Browser
● The name of the Driver executable is chromedriver.exe
● URL to Download-
https://chromedriver.storage.googleapis.com/index.html?path=2.31
/
● Stable Version for Chrome version is 62.0 (Use chromedriver.exe
with version 2.33)
● Browsers
● Firefox Version 57.0
● Chrome Version 62.0
Note: To stop auto update of Firefox browser version, make sure to disconnect
the internet connection and then install 54.0 version, now go to setting/option in
firefox browser and check the below checkbox- Never Checks for updates
Kindly Refer This image
● Application Under Test (AUT)
● Application Name- actiTIME
● Online URL of Application- https://demo.actitime.com/login.do
● Offline URL of Application- https://localhost:8080/login.do
● To Download actiTIME Application Use-
https://www.actitime.com/download.php
How Selenium Perform Automation Testing On Browser?
OR
Architecture of Selenium
Architecture Of Selenium
● Since Selenium supports multiple languages such as Java, Python, C#,
etc. we can develop automation scripts in all the supported languages,
this is known as language binding or client binding.
● When we execute the selenium code, request goes to the selenium
standalone server(also known as Selenium Web driver Server), which
further process the request based on the input received from the client
binding and perform specific actions on the respective browsers using the
browser specific driver executables, Ex. geckodriver.exe for Firefox
browser and chromedriver.exe for chrome browser and so on…
● Driver Executable uses a protocol called JSON Wire Protocol to
communicate with related browsers. here JSON stands for (Java Script
Object Notation).
##Selenium Java Architecture in Details
Explanation of Above image
Search Context is the super most and oldest interface present in selenium
WebDriver having two abstract methods those are findElement() method and
findElements() method this two methods are inherited to Webdriver interface
using extends keyword so that total 13 abstract methods are present in
WebDriver interface because Webdriver Interface is having already its own 11
abstract methods
To provide definition/implementation for 13 abstract methods inside interface we
are using Remote WebDriver Implementation class, All Browser classes are
inherited to Remote WebDriver Class.
Here, To Achieve runtime Polymorphism and to Access 13 abstract methods in
WebDriver interface we are following Concept of upcasting.
TakesScreenshot interface is used to handle the screenshot in selenium along
with that to handle the screenshot in selenium we have to use one method that is
getScreenshotAS method. But here the problem is that in selenium architecture
we have to connect or typecast the TakesScreenshot interface for that we have
to use Typecast Operator.
Next is JavaScriptExecutor interface this interface is used to scroll handling in
selenium along with this interface we have to use one method to handle scroll i.e.
ExecuteScript method here also we have to do typecasting for that we have to
use Typecast operator.
Note: All the above mentioned interfaces and classes are present in a package
called as “org.openqua.selenium”.
To view ant information about Selenium interfaces, classes and methods
navigate to the below page
https://github.com/SeleniumHQ/selenium/tree/master/java/client/src/org/openqa/s
elenium
After Opening this URL below path you have to follow
● List Of All the Methods Present in below Interfaces Of Selenium
WebDriver
1. Search Context Interface
● findElement ()-used to find the element which is present on
webpage
● findElements()-used to find the lists of elements which is
present on webpage
2. WebDriver Interface
● get()– It is used to open URL/Application, return type of this
method is Void.
● close()– It is used to close the current browser window,
return type of this method is Void.
● getTitle()– It is used to get Title of Current Webpage, return
type of this method is String.
● getPageSource()– It is used to get the source code of the
current webpage.
● getCurrentURL()– It is used to get the URL of current
webpage.
● getWindowHandle()– It is used to get the window handle of
current browser window.
● getWindowHandles()– It is used to get the window handle of
all the browser window.
● manage()– It is used to manage browser window.
● navigate()– It is alternative method for get method and it is
used to navigate from one page to another, one page to
previous page and also used to refresh the current
webpage.
● quit()– It is used to close all browser window.
● switchTo()– It is used to switch our control from webpage to
popups, forms, window etc.
● Method of TakesScreenshot Interface
● getscreenshotAS()– It is used to handle the screenshot in
selenium.
● Methods of JavaScriptExecutor Interface
● executeScript()
● executeAsynScript()– We dont use this method for automation.
● Methods of WebElement Interface
● clear()– It is used to clear the value inside the text field/ text box.
● click()– It is used to click buttons, links, radio buttons, checkbox, etc.
● getAttribute()– it is return the value of attributes of webelement.
● getCSSValue()– It is used to get the values of CSS properties like color, size,
font, etc.
● getLocation()– It is used to get the relative position of element present on
webpage.
● getRect()– It is used to fetch the element position with respect to element and
element size.
● getSize()– It is used to get the width and height of target element present on
webpage.
● getTagName()– It is used to get the tagname present on webpage.
● getText()– It is used to get the text present on webpage.
● isDisplayed()– It is used to check whether element is present on webpage or
not.
● isEnabled()– It is used to check whether button is enable or not.
● isSelected()– It is used to determine is that button is selected or not.
● sendkeys()– It is used to enter values inside the text field/ text box.
● submit()– It is used for click on submit button.
Why we Upcast the browser related child class to
WebDriver and not RemoteWebDriver class?
Example of Upcasting
WebDriver driver = new ChromeDriver();
● Converting a child object to super type is called upcasting or in other word
we can say creating object of child class and giving reference of super
class called as a Upcasting.
● In Selenium we use Upcasting so that we can execute the same script on
any browser.
● In Selenium, we can upcast browser object to RemoteWebDriver,
WebDriver, TakesScreenShot, JavaScriptExecutor, etc but a standard
practice is to upcast to WebDriver Interface.
● This is as per the Selenium coding standard set by the Selenium
community. As a testimonial, navigate to the below Selenium community
site and check for the text as mentioned in the image below for reference
image click on below URL.
● http://www.seleniumhq.org/projects/webdriver/
● WebDriver is the name of the key interface against which test should be
written in JAVA, the implementing classes one should use are listed
below:
● ChromeDriver, EventFiringWebDriver, FirefoxDriver, HtmlUnitDriver,
InternetExplorerDriver, PhantonJSDriver, REmoteWbDriver, SafariDriver
Where Did You Use Upcasting In Selenium?
WebDriver driver = new FirefoxDriver();
Explanation of the Above Statement
1. Webdriver is an interface in Selenium that extends the supermost
interface called SearchContext.
2. driver is the upcasted object or Webdriver interface reference variable
3. “=” is an assignment operator.
4. new is a keyword using which object of the FirefoxDriver class is created.
5. FirefoxDriver() is the constructor of FirefoxDriver class which initializes
the object and it will also launch the Firefox browser.
Steps To Install /Integrate Selenium Server To The Java
Project
1. Launch Eclipse and go to package explorer [Navigation path:- Window
Menu–> Show View–> Package Explorer].
2. Create a Java Project[ File–>New–>Java Project].
3. Right Click on Java Project and Add a new Folder with name
“driver”[File–>New–>Folder].
4. Copy geckodriver.exe file from your system and paste it into this driver
folder.
5. Simillarly, create another folder with name “jar” and copy Selenium
Standalone server. jar file into this jar folder.
6. Expand the jar folder and right click on Selenium Standalone server.jar file
–>select Build Path–>Select Add to Build Path.
7. As soon as you add any .jar files to build path , a new folder will be
available called “Reference Libraries” under the package explorer section
and you can see the .jar file is added to this “Reference liabraries”.
8. To remove the .jar file from the java build path is : Right click on the
project–> Build Path–>Configure Build Path–>Libraries Tab–> Add
External Jars–>Select the .jar file –>Apply–>OK.
For More Details Regarding Selenium Kindly Refer Our Next Part Of Selenium
Click here for more details:https://nrc24.com/selenium-2/
Demonstration Program for Upcasting
Concept(FirefoxDriver Class object to WebDriver
interface) and Accessing various methods of WebDriver
interface.
package Sample;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class UpcastingToWebDriver_LaunchBrowser {
public static void main(String[] args) throws
InterruptedException {
//setting the path of the gecko driver executable
System.setProperty("webdriver.gecko.driver",
".drivergeckodriver.exe");
//Launch the Firefox browser
WebDriver driver = new FirefoxDriver();
//Enter the url
driver.get("http://www.google.com");
//Get the title of the google page and print it on the
console
String title = driver.getTitle();
System.out.println("the title of the page is :"+ title);
//Get the URL of the google page and print it on the
console
String currentUrl = driver.getCurrentUrl();
System.out.println("the URL of the page is :"+ currentUrl);
//Get the source code of the google page and print it on
the console
String pageSource = driver.getPageSource();
System.out.println("the source code of the page is :"+
pageSource);
//Halt the program execution for 2 seconds
Thread.sleep(2000);
// Close the browser
driver.close();
}
FAQ’S
1.What is Selenium Used For?
Selenium is a Automation tool used for automation testing and it is supported
multiple languages like Java, C#, Ruby, Python, etc.
2.What is Salary Of Selenium Tester?
Basic Salary of selenium tester in india for fresher tester is minimum 3 lakh to 5
lakh per annum but its depend on the company to company and also depends on
the experience also if you have experience min. 2 to 3 years minimum salary for
that in india is around 7 to 8 lakh.
3.What are the Advantages of Selenium?
● It is Open Source (Source Code is Visible to All)
● It is Free of Cost
● Compatibility is possible
● It is Cross Platform tool.

More Related Content

Similar to Selenium for Tester.pdf

Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
Test Automation Using Selenium
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using Selenium
Nikhil Kapoor
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersProtractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine Reporters
Haitham Refaat
 
Selenium Web Driver Tutorial for Cross Browser Testing
Selenium Web Driver Tutorial for Cross Browser TestingSelenium Web Driver Tutorial for Cross Browser Testing
Selenium Web Driver Tutorial for Cross Browser Testing
Sarah Elson
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdf
AnuragMourya8
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rc
Dang Nguyen
 
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-JupiterToolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Boni García
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Ondřej Machulda
 
Selenium&scrapy
Selenium&scrapySelenium&scrapy
Selenium&scrapy
Arcangelo Saracino
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
orbitprojects
 
Selenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsSelenium Webdriver Interview Questions
Selenium Webdriver Interview Questions
Jai Singh
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
Sun Technlogies
 
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
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
Roman Savitskiy
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using RubyKumari Warsha Goel
 
BCS Selenium Workshop
BCS Selenium WorkshopBCS Selenium Workshop
BCS Selenium Workshop
Colin McDonald
 
Selenium using C# by Yogesh Kumar
Selenium using C# by  Yogesh KumarSelenium using C# by  Yogesh Kumar
Selenium using C# by Yogesh Kumar
Software Testing Board
 
Mobile Test Automation using one API and one infrastructure
Mobile Test Automation using one API and one infrastructureMobile Test Automation using one API and one infrastructure
Mobile Test Automation using one API and one infrastructure
Michael Palotas
 
Selenium 101 Webinar
Selenium 101 WebinarSelenium 101 Webinar
Selenium 101 Webinar
Daniel Herken
 
Selenium
SeleniumSelenium
Selenium
Kalyan ch
 

Similar to Selenium for Tester.pdf (20)

Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
 
Test Automation Using Selenium
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using Selenium
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersProtractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine Reporters
 
Selenium Web Driver Tutorial for Cross Browser Testing
Selenium Web Driver Tutorial for Cross Browser TestingSelenium Web Driver Tutorial for Cross Browser Testing
Selenium Web Driver Tutorial for Cross Browser Testing
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdf
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rc
 
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-JupiterToolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
 
Selenium&scrapy
Selenium&scrapySelenium&scrapy
Selenium&scrapy
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Selenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsSelenium Webdriver Interview Questions
Selenium Webdriver Interview Questions
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
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
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 
BCS Selenium Workshop
BCS Selenium WorkshopBCS Selenium Workshop
BCS Selenium Workshop
 
Selenium using C# by Yogesh Kumar
Selenium using C# by  Yogesh KumarSelenium using C# by  Yogesh Kumar
Selenium using C# by Yogesh Kumar
 
Mobile Test Automation using one API and one infrastructure
Mobile Test Automation using one API and one infrastructureMobile Test Automation using one API and one infrastructure
Mobile Test Automation using one API and one infrastructure
 
Selenium 101 Webinar
Selenium 101 WebinarSelenium 101 Webinar
Selenium 101 Webinar
 
Selenium
SeleniumSelenium
Selenium
 

Recently uploaded

5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx
benykoy2024
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
dxobcob
 
Ethernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.pptEthernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.ppt
azkamurat
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 

Recently uploaded (20)

5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
 
Ethernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.pptEthernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.ppt
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 

Selenium for Tester.pdf

  • 1. Selenium ● Selenium is opensource Web Automation Tool ● It is a tool which is helping to run the scripts using any programming language i.e. Java, Python, Ruby, C#, Java Scripts Etc. ● Advantages Of Selenium ● It is Open Source (Source Code is Visible to All) ● It is Free of Cost ● Compatibility is possible ● It is Cross Platform tool. ● Limitations of Selenium? ● It Doesn’t Support Window Bases Application Directly need third party tool to be integrated. ● We Can not Automate Desktop Bases Applications. ● We Cannot Automate Captcha. ● We Cannot Automate Barcode. ● We Cannot Automate File Uploading. ● We Cannot Automate Ad hoc testcases. Note: Selenium Community Developed Specific Tool Called Appium to Automate Windows Based Applications. Selenium Community Also Developed Tools To Test Mobile Applications 1. Selendroid – It Supports only Android Platform 2. Appium- It Supports Android Platform, MAC, Windows. Note: All Selenium related resources and documents can be found on the below website http://www.seleniumhq.org/
  • 2. · Why Selenium is so Popular and Demanding? Table of Contents ​ · Why Selenium is so Popular and Demanding? ​ ·What Are the Different Flavor’s/Components of Selenium? ​ How Selenium Perform Automation Testing On Browser? ​ Architecture of Selenium ​ Why we Upcast the browser related child class to WebDriver and not RemoteWebDriver class? ​ Where Did You Use Upcasting In Selenium? ​ Steps To Install /Integrate Selenium Server to the Java Project ​ Demonstration Program for Upcasting Concept(FirefoxDriver Class object to WebDriver interface) and Accessing various methods of WebDriver interface. ​ package Sample; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class UpcastingToWebDriver_LaunchBrowser { public static void main(String[] args) throws InterruptedException { //setting the path of the gecko driver executable System.setProperty("webdriver.gecko.driver", ".drivergeckodriver.exe"); //Launch the Firefox browser WebDriver driver = new FirefoxDriver(); //Enter the url driver.get("http://www.google.com"); //Get the title of the google page and print it on the console String title = driver.getTitle(); System.out.println("the title of the page is :"+ title); //Get the URL of the google page and print it on the console String currentUrl = driver.getCurrentUrl(); System.out.println("the URL of the page is :"+ currentUrl); //Get the source code of the google page and print it on the console String pageSource = driver.getPageSource();
  • 3. System.out.println("the source code of the page is :"+ pageSource); //Halt the program execution for 2 seconds Thread.sleep(2000); // Close the browser driver.close(); } ​ FAQ’S ​ 1.What is Selenium Used For? ​ 2.What is Salary Of Selenium Tester? ​ 3.What are the Advantages of Selenium? Selenium is so popular and demanding due to following features 1. It is an Opensource tool freely available on internet 2. No project cost involved 3. No license required 4. Can be easily customize to integrate with other Test management tools like JIRA, ALM, Bugzilla etc. 5. It supports almost 13 different software languages 6. Java 7. C# 8. Python 9. Ruby 10. Perl 11.PHP 12. Java script 13. Haskell 14. R 15. Dart 16. TCL 17. Objective C 18. Java script (Node JS) 6)It Supports All the browsers (Firefox, Chrome, IE, etc.) 7)It Supports almost all the operating System (MAC, Window, Linux, etc.)
  • 4. ·What Are The Different Flavor’s/Components Of Selenium? 1. Selenium Core – Developed by a company Called Thought Works way back in 2004 2. Selenium IDE– Supports only Mozilla Firefox and supports record and playback feature. 3. Selenium RC– Remote control version is 1.x used for parallel execution of automation scripts on multiple remote system. 4. Selenium Webdriver– version is 2.x and 3.x and 4.x Compatibility is possible in this and we can run the scripts in different languages as well. Note: Selenium Web driver version 3.x is no longer capable of running Selenium RC directly, rather it does through emulation and via an interface called WebdriverBackedSelenium but it supports Selenium Grid Directly. 5.Selenium Grid – It is one of the components of selenium that is used to run automation scripts on multiple system simultaneously. It is used to carry out compatibility testing on multiple browsers and platform. ● What Are the Key /Important topic of Selenium? ● Automation framework- Guidelines and Rules to write selenium code ● GitHub- Central Repository to store code ● Maven- Build dependency Tool for auto update of selenium version ● Selenium Grid- To test on multiple OS and browsers ● Jenkins- Continuous Integration ● TestNG- framework for generation of test reports and running multiple test scripts in one go 1. ● What Are the Softwares required for Selenium? ● Eclipse IDE – Oxygen Stable Version ● JDK 1.8 ● Selenium Server Standalone- 3.7.1(Stable version)
  • 5. ● From Where we have to download Selenium Eclipse Here it is the link given below http://www.seleniumhq.org/download ● Driver Executables ● For Firefox Browser ● The Name of driver executable – geckodriver.exe ● URL for download- https://github.com/mozilla/geckodriver/releases ● Version- 0.19 is recommended for Firefox browser with version 56.0 (selenium jar- 3.7.1) ● For Chrome Browser ● The name of the Driver executable is chromedriver.exe ● URL to Download- https://chromedriver.storage.googleapis.com/index.html?path=2.31 / ● Stable Version for Chrome version is 62.0 (Use chromedriver.exe with version 2.33) ● Browsers ● Firefox Version 57.0 ● Chrome Version 62.0 Note: To stop auto update of Firefox browser version, make sure to disconnect the internet connection and then install 54.0 version, now go to setting/option in firefox browser and check the below checkbox- Never Checks for updates
  • 6. Kindly Refer This image ● Application Under Test (AUT) ● Application Name- actiTIME ● Online URL of Application- https://demo.actitime.com/login.do ● Offline URL of Application- https://localhost:8080/login.do ● To Download actiTIME Application Use- https://www.actitime.com/download.php How Selenium Perform Automation Testing On Browser? OR Architecture of Selenium
  • 7. Architecture Of Selenium ● Since Selenium supports multiple languages such as Java, Python, C#, etc. we can develop automation scripts in all the supported languages, this is known as language binding or client binding. ● When we execute the selenium code, request goes to the selenium standalone server(also known as Selenium Web driver Server), which further process the request based on the input received from the client binding and perform specific actions on the respective browsers using the browser specific driver executables, Ex. geckodriver.exe for Firefox browser and chromedriver.exe for chrome browser and so on… ● Driver Executable uses a protocol called JSON Wire Protocol to communicate with related browsers. here JSON stands for (Java Script Object Notation). ##Selenium Java Architecture in Details Explanation of Above image Search Context is the super most and oldest interface present in selenium WebDriver having two abstract methods those are findElement() method and
  • 8. findElements() method this two methods are inherited to Webdriver interface using extends keyword so that total 13 abstract methods are present in WebDriver interface because Webdriver Interface is having already its own 11 abstract methods To provide definition/implementation for 13 abstract methods inside interface we are using Remote WebDriver Implementation class, All Browser classes are inherited to Remote WebDriver Class. Here, To Achieve runtime Polymorphism and to Access 13 abstract methods in WebDriver interface we are following Concept of upcasting. TakesScreenshot interface is used to handle the screenshot in selenium along with that to handle the screenshot in selenium we have to use one method that is getScreenshotAS method. But here the problem is that in selenium architecture we have to connect or typecast the TakesScreenshot interface for that we have to use Typecast Operator. Next is JavaScriptExecutor interface this interface is used to scroll handling in selenium along with this interface we have to use one method to handle scroll i.e. ExecuteScript method here also we have to do typecasting for that we have to use Typecast operator. Note: All the above mentioned interfaces and classes are present in a package called as “org.openqua.selenium”. To view ant information about Selenium interfaces, classes and methods navigate to the below page https://github.com/SeleniumHQ/selenium/tree/master/java/client/src/org/openqa/s elenium After Opening this URL below path you have to follow
  • 9. ● List Of All the Methods Present in below Interfaces Of Selenium WebDriver 1. Search Context Interface ● findElement ()-used to find the element which is present on webpage ● findElements()-used to find the lists of elements which is present on webpage 2. WebDriver Interface ● get()– It is used to open URL/Application, return type of this method is Void. ● close()– It is used to close the current browser window, return type of this method is Void. ● getTitle()– It is used to get Title of Current Webpage, return type of this method is String. ● getPageSource()– It is used to get the source code of the current webpage. ● getCurrentURL()– It is used to get the URL of current webpage. ● getWindowHandle()– It is used to get the window handle of current browser window. ● getWindowHandles()– It is used to get the window handle of all the browser window. ● manage()– It is used to manage browser window.
  • 10. ● navigate()– It is alternative method for get method and it is used to navigate from one page to another, one page to previous page and also used to refresh the current webpage. ● quit()– It is used to close all browser window. ● switchTo()– It is used to switch our control from webpage to popups, forms, window etc. ● Method of TakesScreenshot Interface ● getscreenshotAS()– It is used to handle the screenshot in selenium. ● Methods of JavaScriptExecutor Interface ● executeScript() ● executeAsynScript()– We dont use this method for automation. ● Methods of WebElement Interface ● clear()– It is used to clear the value inside the text field/ text box. ● click()– It is used to click buttons, links, radio buttons, checkbox, etc. ● getAttribute()– it is return the value of attributes of webelement. ● getCSSValue()– It is used to get the values of CSS properties like color, size, font, etc. ● getLocation()– It is used to get the relative position of element present on webpage. ● getRect()– It is used to fetch the element position with respect to element and element size. ● getSize()– It is used to get the width and height of target element present on webpage. ● getTagName()– It is used to get the tagname present on webpage. ● getText()– It is used to get the text present on webpage. ● isDisplayed()– It is used to check whether element is present on webpage or not. ● isEnabled()– It is used to check whether button is enable or not. ● isSelected()– It is used to determine is that button is selected or not. ● sendkeys()– It is used to enter values inside the text field/ text box. ● submit()– It is used for click on submit button. Why we Upcast the browser related child class to WebDriver and not RemoteWebDriver class? Example of Upcasting WebDriver driver = new ChromeDriver();
  • 11. ● Converting a child object to super type is called upcasting or in other word we can say creating object of child class and giving reference of super class called as a Upcasting. ● In Selenium we use Upcasting so that we can execute the same script on any browser. ● In Selenium, we can upcast browser object to RemoteWebDriver, WebDriver, TakesScreenShot, JavaScriptExecutor, etc but a standard practice is to upcast to WebDriver Interface. ● This is as per the Selenium coding standard set by the Selenium community. As a testimonial, navigate to the below Selenium community site and check for the text as mentioned in the image below for reference image click on below URL. ● http://www.seleniumhq.org/projects/webdriver/ ● WebDriver is the name of the key interface against which test should be written in JAVA, the implementing classes one should use are listed below: ● ChromeDriver, EventFiringWebDriver, FirefoxDriver, HtmlUnitDriver, InternetExplorerDriver, PhantonJSDriver, REmoteWbDriver, SafariDriver Where Did You Use Upcasting In Selenium? WebDriver driver = new FirefoxDriver(); Explanation of the Above Statement 1. Webdriver is an interface in Selenium that extends the supermost interface called SearchContext. 2. driver is the upcasted object or Webdriver interface reference variable 3. “=” is an assignment operator. 4. new is a keyword using which object of the FirefoxDriver class is created. 5. FirefoxDriver() is the constructor of FirefoxDriver class which initializes the object and it will also launch the Firefox browser. Steps To Install /Integrate Selenium Server To The Java Project
  • 12. 1. Launch Eclipse and go to package explorer [Navigation path:- Window Menu–> Show View–> Package Explorer]. 2. Create a Java Project[ File–>New–>Java Project]. 3. Right Click on Java Project and Add a new Folder with name “driver”[File–>New–>Folder]. 4. Copy geckodriver.exe file from your system and paste it into this driver folder. 5. Simillarly, create another folder with name “jar” and copy Selenium Standalone server. jar file into this jar folder. 6. Expand the jar folder and right click on Selenium Standalone server.jar file –>select Build Path–>Select Add to Build Path. 7. As soon as you add any .jar files to build path , a new folder will be available called “Reference Libraries” under the package explorer section and you can see the .jar file is added to this “Reference liabraries”. 8. To remove the .jar file from the java build path is : Right click on the project–> Build Path–>Configure Build Path–>Libraries Tab–> Add External Jars–>Select the .jar file –>Apply–>OK. For More Details Regarding Selenium Kindly Refer Our Next Part Of Selenium Click here for more details:https://nrc24.com/selenium-2/ Demonstration Program for Upcasting Concept(FirefoxDriver Class object to WebDriver interface) and Accessing various methods of WebDriver interface. package Sample; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class UpcastingToWebDriver_LaunchBrowser {
  • 13. public static void main(String[] args) throws InterruptedException { //setting the path of the gecko driver executable System.setProperty("webdriver.gecko.driver", ".drivergeckodriver.exe"); //Launch the Firefox browser WebDriver driver = new FirefoxDriver(); //Enter the url driver.get("http://www.google.com"); //Get the title of the google page and print it on the console String title = driver.getTitle(); System.out.println("the title of the page is :"+ title); //Get the URL of the google page and print it on the console String currentUrl = driver.getCurrentUrl(); System.out.println("the URL of the page is :"+ currentUrl); //Get the source code of the google page and print it on the console String pageSource = driver.getPageSource(); System.out.println("the source code of the page is :"+ pageSource); //Halt the program execution for 2 seconds Thread.sleep(2000); // Close the browser driver.close(); }
  • 14. FAQ’S 1.What is Selenium Used For? Selenium is a Automation tool used for automation testing and it is supported multiple languages like Java, C#, Ruby, Python, etc. 2.What is Salary Of Selenium Tester? Basic Salary of selenium tester in india for fresher tester is minimum 3 lakh to 5 lakh per annum but its depend on the company to company and also depends on the experience also if you have experience min. 2 to 3 years minimum salary for that in india is around 7 to 8 lakh. 3.What are the Advantages of Selenium? ● It is Open Source (Source Code is Visible to All) ● It is Free of Cost ● Compatibility is possible ● It is Cross Platform tool.