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

PPTX
Selenium_For_Beginners_VodQA_Final
PPTX
Build Tools-Introduction (3)
PPTX
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
PDF
React native-meetup-talk
PPTX
[Srijan Wednesday Webinars] Developing Large Scale Applications in AngularJS
PDF
Алексей Волков "Введение в React Native"
PDF
Choosing the best JavaScript framework/library/toolkit
PPTX
React Native
Selenium_For_Beginners_VodQA_Final
Build Tools-Introduction (3)
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
React native-meetup-talk
[Srijan Wednesday Webinars] Developing Large Scale Applications in AngularJS
Алексей Волков "Введение в React Native"
Choosing the best JavaScript framework/library/toolkit
React Native

What's hot (20)

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

Similar to Selenium (20)

PDF
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
PDF
How To Use Selenium Successfully (Java Edition)
PDF
How To Use Selenium Successfully
PDF
Breaking the limits_of_page_objects
PDF
Getting Started with Selenium
PPTX
Selenium Automation
PDF
Mastering Test Automation: How to Use Selenium Successfully
KEY
Getting started with Selenium 2
PDF
Gilt Groupe's Selenium 2 Conversion Challenges
PDF
Automation Testing using Selenium Webdriver
PPTX
Selenium
PDF
How to use selenium successfully
PPT
Automation with Selenium Presented by Quontra Solutions
PDF
How To Use Selenium Successfully (Java Edition)
PPTX
Automation Testing
PPTX
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
ZIP
Browser-Based testing using Selenium
PDF
Real World Selenium
PDF
Selenium Introduction by Sandeep Sharda
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully
Breaking the limits_of_page_objects
Getting Started with Selenium
Selenium Automation
Mastering Test Automation: How to Use Selenium Successfully
Getting started with Selenium 2
Gilt Groupe's Selenium 2 Conversion Challenges
Automation Testing using Selenium Webdriver
Selenium
How to use selenium successfully
Automation with Selenium Presented by Quontra Solutions
How To Use Selenium Successfully (Java Edition)
Automation Testing
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Browser-Based testing using Selenium
Real World Selenium
Selenium Introduction by Sandeep Sharda
Ad

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.