SlideShare a Scribd company logo
RBS54273
2
RBS54273
History
• 2004, ThoughtWorks, Chicago, Jason Huggins, Core code.
• Shinya Kasatani, ThoughtWorks, Japan, Selenium IDE.
• Jason Huggins, left ThoughtWorks, 2007.
• Jennifer Bevan & Jason Huggins, Google, Worked on RC.
• Simon Stewart, ThoughtWorks, WebDriver.
3
RBS54273
What
• Framework that runs in your web-browser and in headless mode.
• Hooks for many other languages.
–Java, Ruby, Python, C# etc
• Simulate a user navigating through pages and then assert for specific marks
on the pages.
• Antidote to Mercury poisoning.
4
RBS54273
Types
• IDE
• RC – Selenium 1
• Webdriver – Selenium 2
• Grid
5
RBS54273
Why
• Open source.
• Supports multiple languages.
• Cross browser support.
• Cross OS support.
• Runs in both headless and browser mode.
• Parallel execution.
• CI compatible.
• Unit testing framework support like Junit, TestNG, NUnit, Rspec etc.
• Mobile testing support using Android, IPhone, IPad & Blackberry drivers etc.
6
RBS54273
Locators
• ID
–id=textId
• Name
–name=textName
• CSS
–css=em
• XPATH
–Relative (//div[@id=‘123’]/span)
–Absolute (/html/body/div[1])
7
RBS54273
IDE
8
RBS54273
IDE Cont-d
9
RBS54273
IDE Cont-d
10
RBS54273
RC
11
RBS54273
WebDriver
12
RBS54273
RC Vs WebDriver
13
RBS54273
RC Vs WebDriver Cont-d
14
RBS54273
Page object model
• Challenge
–Unmaintainable project.
–Duplicated code.
–Not easy to track changes.
• Solution
–Use Page object model.
• About
–All page specific elements/ methods has to be extracted to separate classes.
–Eliminates duplication.
–Improves readability.
– Less key strokes.
15
RBS54273
P.O.M Cont-d
public class LoginPage
{
//Locators assigned to variables
@FindBy(how = How.ID, using = “password")
private static WebElement passwordTextField = null;
@FindBy(how = How.NAME, using = “username")
private static WebElement userNameTextField = null;
@FindBy(how = How.XPATH, using = "//input[@name=‘loginButton’]")
private static WebElement loginButton = null;
//Expose methods
public HomePage login(String userName, String password )
{
userNameTextField.sendKeys(userName);
passwordTextField.sendKeys(password);
loginButton.click();
return new HomePage();
}
}
Then in any test class we can call above function like :
LoginPage loginPage=new LoginPage();
HomePage homePage=loginPage.login(“singmaz”,”pass123#”);
16
RBS54273
Grid
17
RBS54273
Grid - console
18
RBS54273
Steps
1) java -jar selenium-server-standalone-2.14.0.jar -role hub (by default it registers at
4444)
2) Open the browser and run the following URL http://localhost:4444/console
3) Open the command prompt at node1 and go to the directory “selenium-grid-1.0.8-
binselenium-grid-1.0.8”
4) Type : java -jar selenium-server-standalone-2.14.0.jar -role node -Dport=5555
-Dhost=192.168.1.149 -DhubURL=http://192.168.1.25:4444 -Denvironment=*firefox
launch-remote-control
5) Similarly for node2…….noden
6) Everything is sorted.
19
RBS54273
20
RBS54273

More Related Content

What's hot

Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Dakiry
 
JS Framework Comparison - An infographic
JS Framework Comparison - An infographicJS Framework Comparison - An infographic
JS Framework Comparison - An infographic
InApp
 
On Selecting JavaScript Frameworks (Women Who Code 10/15)
On Selecting JavaScript Frameworks (Women Who Code 10/15)On Selecting JavaScript Frameworks (Women Who Code 10/15)
On Selecting JavaScript Frameworks (Women Who Code 10/15)
Zoe Landon
 
Real World Web components
Real World Web componentsReal World Web components
Real World Web components
Jarrod Overson
 
ITT Flisol 2013
ITT Flisol 2013ITT Flisol 2013
ITT Flisol 2013
Domingo Suarez Torres
 
Selenium testing
Selenium testingSelenium testing
Selenium testing
Jason Myers
 
React Component Library Design @WalmartLabs
React Component Library Design @WalmartLabsReact Component Library Design @WalmartLabs
React Component Library Design @WalmartLabs
chaseadamsio
 
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
MarkupBox
 
jQuery Conference 2012 keynote
jQuery Conference 2012 keynotejQuery Conference 2012 keynote
jQuery Conference 2012 keynotedmethvin
 
Angular 2 vs React
Angular 2 vs ReactAngular 2 vs React
Angular 2 vs React
Iran Reyes Fleitas
 
Natural Language UI Testing using Behavior Driven Development with Pavlov and...
Natural Language UI Testing using Behavior Driven Development with Pavlov and...Natural Language UI Testing using Behavior Driven Development with Pavlov and...
Natural Language UI Testing using Behavior Driven Development with Pavlov and...
Eric DeLabar
 
Top java script frameworks ppt
Top java script frameworks pptTop java script frameworks ppt
Top java script frameworks ppt
Omkarsoft Bangalore
 
SGCE 2012 Lightning Talk-Single Page Interface
SGCE 2012 Lightning Talk-Single Page InterfaceSGCE 2012 Lightning Talk-Single Page Interface
SGCE 2012 Lightning Talk-Single Page Interface
Domingo Suarez Torres
 
React Native
React NativeReact Native
React Native
Artyom Trityak
 
Latest Javascript MVC & Front End Frameworks 2017
Latest Javascript MVC & Front End Frameworks 2017Latest Javascript MVC & Front End Frameworks 2017
Latest Javascript MVC & Front End Frameworks 2017
AmarInfotech
 
Mvvm knockout vs angular
Mvvm knockout vs angularMvvm knockout vs angular
Mvvm knockout vs angular
Basarat Syed
 
AngularJS is awesome
AngularJS is awesomeAngularJS is awesome
AngularJS is awesome
Eusebiu Schipor
 
Angularjs for kolkata drupal meetup
Angularjs for kolkata drupal meetupAngularjs for kolkata drupal meetup
Angularjs for kolkata drupal meetupGoutam Dey
 
Building great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapiBuilding great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapi
Maurice De Beijer [MVP]
 

What's hot (20)

Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
 
JS Framework Comparison - An infographic
JS Framework Comparison - An infographicJS Framework Comparison - An infographic
JS Framework Comparison - An infographic
 
On Selecting JavaScript Frameworks (Women Who Code 10/15)
On Selecting JavaScript Frameworks (Women Who Code 10/15)On Selecting JavaScript Frameworks (Women Who Code 10/15)
On Selecting JavaScript Frameworks (Women Who Code 10/15)
 
Real World Web components
Real World Web componentsReal World Web components
Real World Web components
 
ITT Flisol 2013
ITT Flisol 2013ITT Flisol 2013
ITT Flisol 2013
 
Selenium testing
Selenium testingSelenium testing
Selenium testing
 
React Component Library Design @WalmartLabs
React Component Library Design @WalmartLabsReact Component Library Design @WalmartLabs
React Component Library Design @WalmartLabs
 
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
 
jQuery Conference 2012 keynote
jQuery Conference 2012 keynotejQuery Conference 2012 keynote
jQuery Conference 2012 keynote
 
Angular 2 vs React
Angular 2 vs ReactAngular 2 vs React
Angular 2 vs React
 
Natural Language UI Testing using Behavior Driven Development with Pavlov and...
Natural Language UI Testing using Behavior Driven Development with Pavlov and...Natural Language UI Testing using Behavior Driven Development with Pavlov and...
Natural Language UI Testing using Behavior Driven Development with Pavlov and...
 
Top java script frameworks ppt
Top java script frameworks pptTop java script frameworks ppt
Top java script frameworks ppt
 
SGCE 2012 Lightning Talk-Single Page Interface
SGCE 2012 Lightning Talk-Single Page InterfaceSGCE 2012 Lightning Talk-Single Page Interface
SGCE 2012 Lightning Talk-Single Page Interface
 
React Native
React NativeReact Native
React Native
 
Latest Javascript MVC & Front End Frameworks 2017
Latest Javascript MVC & Front End Frameworks 2017Latest Javascript MVC & Front End Frameworks 2017
Latest Javascript MVC & Front End Frameworks 2017
 
Mvvm knockout vs angular
Mvvm knockout vs angularMvvm knockout vs angular
Mvvm knockout vs angular
 
AngularJS is awesome
AngularJS is awesomeAngularJS is awesome
AngularJS is awesome
 
Angularjs for kolkata drupal meetup
Angularjs for kolkata drupal meetupAngularjs for kolkata drupal meetup
Angularjs for kolkata drupal meetup
 
React mini lecture
React mini lectureReact mini lecture
React mini lecture
 
Building great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapiBuilding great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapi
 

Similar to Selenium

Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
Gunnar Hillert
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
Derek Jacoby
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
TEST Huddle
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
Elad Hirsch
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
Applitools
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache Usergrid
David M. Johnson
 
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect ModelComprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
vodQA
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Ganesh Kondal
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS偉格 高
 
Effective Testing using Behavior-Driven Development
Effective Testing using Behavior-Driven DevelopmentEffective Testing using Behavior-Driven Development
Effective Testing using Behavior-Driven Development
Alexander Kress
 
Writing an extensible web testing framework ready for the cloud slide share
Writing an extensible web testing framework ready for the cloud   slide shareWriting an extensible web testing framework ready for the cloud   slide share
Writing an extensible web testing framework ready for the cloud slide share
Mike Ensor
 
DrupalCon 2011 Highlight
DrupalCon 2011 HighlightDrupalCon 2011 Highlight
DrupalCon 2011 Highlight
Supakit Kiatrungrit
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009
Jason Davies
 
Test Automation using Ruby
Test Automation using Ruby Test Automation using Ruby
Test Automation using Ruby
Sla Va
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Doris Chen
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
Dave Haeffner
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
Oscar Merida
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
Luís Bastião Silva
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Roy de Kleijn
 

Similar to Selenium (20)

Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache Usergrid
 
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect ModelComprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
 
Effective Testing using Behavior-Driven Development
Effective Testing using Behavior-Driven DevelopmentEffective Testing using Behavior-Driven Development
Effective Testing using Behavior-Driven Development
 
Writing an extensible web testing framework ready for the cloud slide share
Writing an extensible web testing framework ready for the cloud   slide shareWriting an extensible web testing framework ready for the cloud   slide share
Writing an extensible web testing framework ready for the cloud slide share
 
DrupalCon 2011 Highlight
DrupalCon 2011 HighlightDrupalCon 2011 Highlight
DrupalCon 2011 Highlight
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009
 
Test Automation using Ruby
Test Automation using Ruby Test Automation using Ruby
Test Automation using Ruby
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
JS Essence
JS EssenceJS Essence
JS Essence
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
 

Selenium

  • 2. 2 RBS54273 History • 2004, ThoughtWorks, Chicago, Jason Huggins, Core code. • Shinya Kasatani, ThoughtWorks, Japan, Selenium IDE. • Jason Huggins, left ThoughtWorks, 2007. • Jennifer Bevan & Jason Huggins, Google, Worked on RC. • Simon Stewart, ThoughtWorks, WebDriver.
  • 3. 3 RBS54273 What • Framework that runs in your web-browser and in headless mode. • Hooks for many other languages. –Java, Ruby, Python, C# etc • Simulate a user navigating through pages and then assert for specific marks on the pages. • Antidote to Mercury poisoning.
  • 4. 4 RBS54273 Types • IDE • RC – Selenium 1 • Webdriver – Selenium 2 • Grid
  • 5. 5 RBS54273 Why • Open source. • Supports multiple languages. • Cross browser support. • Cross OS support. • Runs in both headless and browser mode. • Parallel execution. • CI compatible. • Unit testing framework support like Junit, TestNG, NUnit, Rspec etc. • Mobile testing support using Android, IPhone, IPad & Blackberry drivers etc.
  • 6. 6 RBS54273 Locators • ID –id=textId • Name –name=textName • CSS –css=em • XPATH –Relative (//div[@id=‘123’]/span) –Absolute (/html/body/div[1])
  • 14. 14 RBS54273 Page object model • Challenge –Unmaintainable project. –Duplicated code. –Not easy to track changes. • Solution –Use Page object model. • About –All page specific elements/ methods has to be extracted to separate classes. –Eliminates duplication. –Improves readability. – Less key strokes.
  • 15. 15 RBS54273 P.O.M Cont-d public class LoginPage { //Locators assigned to variables @FindBy(how = How.ID, using = “password") private static WebElement passwordTextField = null; @FindBy(how = How.NAME, using = “username") private static WebElement userNameTextField = null; @FindBy(how = How.XPATH, using = "//input[@name=‘loginButton’]") private static WebElement loginButton = null; //Expose methods public HomePage login(String userName, String password ) { userNameTextField.sendKeys(userName); passwordTextField.sendKeys(password); loginButton.click(); return new HomePage(); } } Then in any test class we can call above function like : LoginPage loginPage=new LoginPage(); HomePage homePage=loginPage.login(“singmaz”,”pass123#”);
  • 18. 18 RBS54273 Steps 1) java -jar selenium-server-standalone-2.14.0.jar -role hub (by default it registers at 4444) 2) Open the browser and run the following URL http://localhost:4444/console 3) Open the command prompt at node1 and go to the directory “selenium-grid-1.0.8- binselenium-grid-1.0.8” 4) Type : java -jar selenium-server-standalone-2.14.0.jar -role node -Dport=5555 -Dhost=192.168.1.149 -DhubURL=http://192.168.1.25:4444 -Denvironment=*firefox launch-remote-control 5) Similarly for node2…….noden 6) Everything is sorted.