SlideShare a Scribd company logo
Introduction to Selenium Web Driver 
Kokhanjuk Maria Test Lead 
2012 www.ExigenServices.com
2 www.ExigenServices.com 
Agenda 
•What is Selenium 2.0 
•Architecture of Selenium 2.0 
•Selenium 2.0 API: 
• Finding elements 
• Basic operations on elements 
• Moving between windows and frames 
• Explicit and Implicit Waits 
•Creating tests using Selenium 2.0
3 www.ExigenServices.com 
What is Selenium? 
Selenium is a set of tools for cross-platform automated testing 
of web applications. 
Selenium supports: 
• IE, Firefox, Safari, Opera and other browsers 
• Windows, OS X, Linux, Solaris and other OS’s 
• C#, Java, Perl, PHP, Python, Ruby and other languages 
• Bromine, JUnit, NUnit, RSpec, TestNG, unittest
Components of Selenium 
4 www.ExigenServices.com 
• Selenium IDE 
• Selenium Remote Control (RC) 
• Selenium Grid 
• Selenium 2.0 and WebDriver
What is Selenium 2.0 ? 
Selenium 1.0 Webdriver 
5 www.ExigenServices.com 
merge 
Selenium 
Webdriver 2.0 
IDE 
Selenium RC 
Selenium Grid
Selenium 1.0 Architecture 
6 www.ExigenServices.com 
Autotests 
(Java, PHP, Phyton, 
Ruby, C#, …) 
Selenium RC 
Browsers 
Web-application 
HTTP
Selenium 2.0 Architecture 
7 www.ExigenServices.com 
Autotests Driver Browsers 
Web-application 
API 
to control the 
browser
Advantages of Selenium 2.0 
• The development and connection of new drivers, 
adapted to the specific test environment 
• A more "advanced" API for writing tests 
• Events generated are the same as for manual testing 
• Work with invisible elements is not available 
8 www.ExigenServices.com
Disadvantages of Selenium 2.0 
• Need to create own webdriver for each test 
9 www.ExigenServices.com 
environment 
• Only 4 programming languages are supported
10 www.ExigenServices.com 
WebDriver 
WebDriver’s Drivers 
•HtmlUnit Driver 
•Firefox Driver 
•Internet Explorer Driver 
•Chrome Driver 
•Opera Driver 
•iPhone Driver 
•Android Driver
WebDriver driver = new FirefoxDriver(); 
11 www.ExigenServices.com 
Selenium API 
WebDriver – to control the browser 
WebElement – to work with the elements on the page 
WebElement element = 
driver.findElement(By.id(“id”));
12 www.ExigenServices.com 
WebDriver API 
 void get(java.lang.String url) – open page 
 void quit() – close browser 
 WebDriver.TargetLocator switchTo() – switching 
between the popup-E, alert, windows 
 WebElement findElement(By by) -– find element by 
locator 
 List<WebElement> findElements(By by) – find 
elements by locator
Selenium API: Find elements 
13 www.ExigenServices.com 
 By.id("idOfObject") 
 By.linkText("TextUsedInTheLink") 
 By.partialLinkText("partOfThelink") 
 By.tagName("theHTMLNodeType") 
 By.className("cssClassOnTheElement") 
 By.cssSelector("cssSelectorToTheElement") 
 By.xpath("//Xpath/to/the/element") 
 By.name("nameOfElement")
Selenium API: Find elements 
14 www.ExigenServices.com 
Tools for finding elements: 
1. Firebug. Download firebug at http://getfirebug.com/ 
2. Firefinder for Firebug
Selenium API: Find elements 
http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#selectors 
15 www.ExigenServices.com
Selenium API: Basic operations on 
elements 
16 www.ExigenServices.com 
 void click() 
 void submit() 
 String getValue() 
 void sendKeys(keysToSend) 
 void clear() 
 String getElementName() 
 String getAttribute(java.lang.String name) 
 boolean toggle()
17 www.ExigenServices.com 
Selenium API: Waits 
Implicit Waits 
Explicit Waits
Working with windows 
18 www.ExigenServices.com 
 Working with browser windows 
driver.getWindowHandles() 
driver.switchTo().window(windowName) 
 Working with frames 
driver.switchTo().frame( "frameName" ); 
 Working with alerts 
driver.switchTo().alert();
19 www.ExigenServices.com 
Create tests 
1. Java 
http://java.com/ru/download 
2. IDE 
3. Library Selenium WebDriver 
http://seleniumhq.org/download/ 
4. Firebug
20 www.ExigenServices.com 
Create test 
Test Case: 
Selenium is in the first line of request for rambler search 
Condition: 
Browser is open 
Steps: 
1. Enter “selenium webdriver” into search request 
2. Press search button 
Expected result: 
The first line of request must be a link to the official 
Selenium website
21 www.ExigenServices.com 
Create test 
public class Rambler { 
protected WebDriver driver; 
@Before 
public void setUp() throws Exception { 
System.out.println("tmp"); 
// driver = new FirefoxDriver(); 
driver = new InternetExplorerDriver(); 
driver.get("http://www.rambler.ru/"); 
}
22 www.ExigenServices.com 
Create test 
@Test 
public void RamblerSearch() throws Exception { 
System.out.println(" TC: Selenium is in the first line of request for rambler search"); 
waitUntilDisplayed(By.cssSelector(Constants.txtRambler)); 
driver.findElement(By.cssSelector(Constants.txtRambler)).sendKeys("selenium webdriver"); 
driver.findElement(By.className("pointer")).click(); 
//wait first result 
waitUntilDisplayed(By.cssSelector("div[class='b-left-column__wrapper']")); 
assertTrue(driver.findElement(By.cssSelector("div[class='b-podmes_books b-podmes_ 
top_1']")).getText().contains("Selenium - Web Browser Automation")); 
}
23 www.ExigenServices.com 
Create test 
public class Constants { 
public static final String txtRambler = "input[class='r--hat-form-text-input']"; 
}
24 www.ExigenServices.com 
Create test 
@Test 
public void RamblerSearch() throws Exception { 
System.out.println(" TC: Selenium is in the first line of request for rambler search"); 
waitUntilDisplayed(By.cssSelector(Constants.txtRambler)); 
driver.findElement(By.cssSelector(Constants.txtRambler)).sendKeys("selenium webdriver"); 
driver.findElement(By.className("pointer")).click(); 
//wait first result 
waitUntilDisplayed(By.cssSelector("div[class='b-left-column__wrapper']")); 
assertTrue(driver.findElement(By.cssSelector("div[class='b-podmes_books b-podmes_ 
top_1']")).getText().contains("Selenium - Web Browser Automation")); 
}
25 www.ExigenServices.com 
Create test 
public void waitUntilDisplayed(final By locator) { 
( new WebDriverWait(driver, 120)).until(new ExpectedCondition<Boolean>() { 
public Boolean apply(WebDriver d) { 
return d.findElement(locator).isDisplayed(); 
} 
}); 
} 
@After 
public void tearDown() throws Exception { 
//close browser 
driver.quit(); 
}
26 www.ExigenServices.com 
Create test: result
27 www.ExigenServices.com 
Create test: result
28 www.ExigenServices.com 
Structure of the test 
1. Use Set UP () and tearDown() 
2. All tests should finish with assertion 
3. Elements’ locators should be defined in separate 
class
30 www.ExigenServices.com 
Useful links 
• http://seleniumhq.org/docs/ 
• http://software-testing.ru/library/testing/functional-testing/ 
1398-selenium-20 
• http://automated-testing. 
info/knowledgebase/avtomatizaciya-funkcionalnogo- 
testirovaniya/selenium 
• http://autotestgroup.com/ru/ 
• http://www.w3.org/TR/2001/CR-css3-selectors- 
20011113/#selectors 
• http://junit.org
31 www.ExigenServices.com 
Questions 
Questions?

More Related Content

What's hot

Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
Yuriy Bezgachnyuk
 
Web driver training
Web driver trainingWeb driver training
Web driver training
Dipesh Bhatewara
 
Selenium with java
Selenium with javaSelenium with java
Selenium with java
Satyam Pandey
 
Selenium webdriver
Selenium webdriverSelenium webdriver
Selenium webdriver
sean_todd
 
Selenium
SeleniumSelenium
Selenium
mdiliyazm
 
Selenium training
Selenium trainingSelenium training
Selenium training
Suresh Arora
 
Selenium presentation
Selenium presentationSelenium presentation
Selenium presentation
P.V.G'S COET, PUNE - 09
 
Automation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsAutomation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra Solutions
Quontra Solutions
 
Introduction to Selenium
Introduction to SeleniumIntroduction to Selenium
Introduction to Selenium
rohitnayak
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
Ynon Perek
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summary
Alan Richardson
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answers
ITeLearn
 
Selenium testing - Handle Elements in WebDriver
Selenium testing - Handle Elements in WebDriver Selenium testing - Handle Elements in WebDriver
Selenium testing - Handle Elements in WebDriver
Vibrant Technologies & Computers
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
Praveen Gorantla
 
Selenium Overview
Selenium OverviewSelenium Overview
Selenium Overview
Abhijeet Vaikar
 
Boston selenium meetup: Selenium 2
Boston selenium meetup: Selenium 2Boston selenium meetup: Selenium 2
Boston selenium meetup: Selenium 2epall
 
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
 
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)

Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
Web driver training
Web driver trainingWeb driver training
Web driver training
 
Selenium with java
Selenium with javaSelenium with java
Selenium with java
 
Selenium Concepts
Selenium ConceptsSelenium Concepts
Selenium Concepts
 
Selenium webdriver
Selenium webdriverSelenium webdriver
Selenium webdriver
 
Selenium
SeleniumSelenium
Selenium
 
Selenium training
Selenium trainingSelenium training
Selenium training
 
Selenium presentation
Selenium presentationSelenium presentation
Selenium presentation
 
Automation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsAutomation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra Solutions
 
Introduction to Selenium
Introduction to SeleniumIntroduction to Selenium
Introduction to Selenium
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summary
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answers
 
Selenium testing - Handle Elements in WebDriver
Selenium testing - Handle Elements in WebDriver Selenium testing - Handle Elements in WebDriver
Selenium testing - Handle Elements in WebDriver
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
Selenium Overview
Selenium OverviewSelenium Overview
Selenium Overview
 
Boston selenium meetup: Selenium 2
Boston selenium meetup: Selenium 2Boston selenium meetup: Selenium 2
Boston selenium meetup: Selenium 2
 
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
 
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
 

Similar to Introduction to selenium web driver

Introduction to selenium web driver
Introduction to selenium web driverIntroduction to selenium web driver
Introduction to selenium web driver
Return on Intelligence
 
Getting started with Selenium 2
Getting started with Selenium 2Getting started with Selenium 2
Getting started with Selenium 2
Sebastiano Armeli
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
orbitprojects
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdf
AnuragMourya8
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Atirek Gupta
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
Rajathi-QA
 
Selenium for Tester.pdf
Selenium for Tester.pdfSelenium for Tester.pdf
Selenium for Tester.pdf
RTechRInfoIT
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
Sun Technlogies
 
Selenium Automation in Java Using HttpWatch Plug-in
 Selenium Automation in Java Using HttpWatch Plug-in  Selenium Automation in Java Using HttpWatch Plug-in
Selenium Automation in Java Using HttpWatch Plug-in
Sandeep Tol
 
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pdfTop 15 Selenium WebDriver Interview Questions and Answers.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
AnanthReddy38
 
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Edureka!
 
Selenium Introduction by Sandeep Sharda
Selenium Introduction by Sandeep ShardaSelenium Introduction by Sandeep Sharda
Selenium Introduction by Sandeep ShardaEr. Sndp Srda
 
Selenium withnet
Selenium withnetSelenium withnet
Selenium withnetVlad Maniak
 
Selenium
SeleniumSelenium
Selenium
Sun Technlogies
 
Latest Selenium Interview Questions And Answers.pdf
Latest Selenium Interview Questions And Answers.pdfLatest Selenium Interview Questions And Answers.pdf
Latest Selenium Interview Questions And Answers.pdf
Varsha Rajput
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - Introduction
Amr E. Mohamed
 
Component Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumComponent Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with Selenium
Richard Olrichs
 
Automated Testing ADF with Selenium
Automated Testing ADF with SeleniumAutomated Testing ADF with Selenium
Automated Testing ADF with Selenium
Wilfred van der Deijl
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Selenium RC - Web Application Testing Tool
Selenium RC - Web Application Testing ToolSelenium RC - Web Application Testing Tool
Selenium RC - Web Application Testing Tool
Atsushi Sano
 

Similar to Introduction to selenium web driver (20)

Introduction to selenium web driver
Introduction to selenium web driverIntroduction to selenium web driver
Introduction to selenium web driver
 
Getting started with Selenium 2
Getting started with Selenium 2Getting started with Selenium 2
Getting started with Selenium 2
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdf
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
Selenium for Tester.pdf
Selenium for Tester.pdfSelenium for Tester.pdf
Selenium for Tester.pdf
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Selenium Automation in Java Using HttpWatch Plug-in
 Selenium Automation in Java Using HttpWatch Plug-in  Selenium Automation in Java Using HttpWatch Plug-in
Selenium Automation in Java Using HttpWatch Plug-in
 
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pdfTop 15 Selenium WebDriver Interview Questions and Answers.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
 
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
 
Selenium Introduction by Sandeep Sharda
Selenium Introduction by Sandeep ShardaSelenium Introduction by Sandeep Sharda
Selenium Introduction by Sandeep Sharda
 
Selenium withnet
Selenium withnetSelenium withnet
Selenium withnet
 
Selenium
SeleniumSelenium
Selenium
 
Latest Selenium Interview Questions And Answers.pdf
Latest Selenium Interview Questions And Answers.pdfLatest Selenium Interview Questions And Answers.pdf
Latest Selenium Interview Questions And Answers.pdf
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - Introduction
 
Component Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumComponent Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with Selenium
 
Automated Testing ADF with Selenium
Automated Testing ADF with SeleniumAutomated Testing ADF with Selenium
Automated Testing ADF with Selenium
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
 
Selenium RC - Web Application Testing Tool
Selenium RC - Web Application Testing ToolSelenium RC - Web Application Testing Tool
Selenium RC - Web Application Testing Tool
 

More from Return on Intelligence

Clean Code Approach
Clean Code ApproachClean Code Approach
Clean Code Approach
Return on Intelligence
 
Code Coverage
Code CoverageCode Coverage
Code Coverage
Return on Intelligence
 
Effective Communication in english
Effective Communication in englishEffective Communication in english
Effective Communication in english
Return on Intelligence
 
Anti-patterns
Anti-patternsAnti-patterns
Anti-patterns
Return on Intelligence
 
Conflicts Resolving
Conflicts ResolvingConflicts Resolving
Conflicts Resolving
Return on Intelligence
 
Database versioning with liquibase
Database versioning with liquibaseDatabase versioning with liquibase
Database versioning with liquibase
Return on Intelligence
 
Effective Feedback
Effective FeedbackEffective Feedback
Effective Feedback
Return on Intelligence
 
English for Negotiations 2016
English for Negotiations 2016English for Negotiations 2016
English for Negotiations 2016
Return on Intelligence
 
Lean Software Development
Lean Software DevelopmentLean Software Development
Lean Software Development
Return on Intelligence
 
Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!
Return on Intelligence
 
Quick Start to AngularJS
Quick Start to AngularJSQuick Start to AngularJS
Quick Start to AngularJS
Return on Intelligence
 
Introduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsIntroduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.js
Return on Intelligence
 
Types of testing and their classification
Types of testing and their classificationTypes of testing and their classification
Types of testing and their classification
Return on Intelligence
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
Return on Intelligence
 
Enterprise Service Bus
Enterprise Service BusEnterprise Service Bus
Enterprise Service Bus
Return on Intelligence
 
Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)
Return on Intelligence
 
Apache cassandra - future without boundaries (part2)
Apache cassandra - future without boundaries (part2)Apache cassandra - future without boundaries (part2)
Apache cassandra - future without boundaries (part2)
Return on Intelligence
 
Apache cassandra - future without boundaries (part1)
Apache cassandra - future without boundaries (part1)Apache cassandra - future without boundaries (part1)
Apache cassandra - future without boundaries (part1)
Return on Intelligence
 
Career development in exigen services
Career development in exigen servicesCareer development in exigen services
Career development in exigen services
Return on Intelligence
 
Enterprise service bus part 2
Enterprise service bus part 2Enterprise service bus part 2
Enterprise service bus part 2
Return on Intelligence
 

More from Return on Intelligence (20)

Clean Code Approach
Clean Code ApproachClean Code Approach
Clean Code Approach
 
Code Coverage
Code CoverageCode Coverage
Code Coverage
 
Effective Communication in english
Effective Communication in englishEffective Communication in english
Effective Communication in english
 
Anti-patterns
Anti-patternsAnti-patterns
Anti-patterns
 
Conflicts Resolving
Conflicts ResolvingConflicts Resolving
Conflicts Resolving
 
Database versioning with liquibase
Database versioning with liquibaseDatabase versioning with liquibase
Database versioning with liquibase
 
Effective Feedback
Effective FeedbackEffective Feedback
Effective Feedback
 
English for Negotiations 2016
English for Negotiations 2016English for Negotiations 2016
English for Negotiations 2016
 
Lean Software Development
Lean Software DevelopmentLean Software Development
Lean Software Development
 
Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!
 
Quick Start to AngularJS
Quick Start to AngularJSQuick Start to AngularJS
Quick Start to AngularJS
 
Introduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsIntroduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.js
 
Types of testing and their classification
Types of testing and their classificationTypes of testing and their classification
Types of testing and their classification
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
 
Enterprise Service Bus
Enterprise Service BusEnterprise Service Bus
Enterprise Service Bus
 
Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)
 
Apache cassandra - future without boundaries (part2)
Apache cassandra - future without boundaries (part2)Apache cassandra - future without boundaries (part2)
Apache cassandra - future without boundaries (part2)
 
Apache cassandra - future without boundaries (part1)
Apache cassandra - future without boundaries (part1)Apache cassandra - future without boundaries (part1)
Apache cassandra - future without boundaries (part1)
 
Career development in exigen services
Career development in exigen servicesCareer development in exigen services
Career development in exigen services
 
Enterprise service bus part 2
Enterprise service bus part 2Enterprise service bus part 2
Enterprise service bus part 2
 

Recently uploaded

Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 

Recently uploaded (20)

Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 

Introduction to selenium web driver

  • 1. Introduction to Selenium Web Driver Kokhanjuk Maria Test Lead 2012 www.ExigenServices.com
  • 2. 2 www.ExigenServices.com Agenda •What is Selenium 2.0 •Architecture of Selenium 2.0 •Selenium 2.0 API: • Finding elements • Basic operations on elements • Moving between windows and frames • Explicit and Implicit Waits •Creating tests using Selenium 2.0
  • 3. 3 www.ExigenServices.com What is Selenium? Selenium is a set of tools for cross-platform automated testing of web applications. Selenium supports: • IE, Firefox, Safari, Opera and other browsers • Windows, OS X, Linux, Solaris and other OS’s • C#, Java, Perl, PHP, Python, Ruby and other languages • Bromine, JUnit, NUnit, RSpec, TestNG, unittest
  • 4. Components of Selenium 4 www.ExigenServices.com • Selenium IDE • Selenium Remote Control (RC) • Selenium Grid • Selenium 2.0 and WebDriver
  • 5. What is Selenium 2.0 ? Selenium 1.0 Webdriver 5 www.ExigenServices.com merge Selenium Webdriver 2.0 IDE Selenium RC Selenium Grid
  • 6. Selenium 1.0 Architecture 6 www.ExigenServices.com Autotests (Java, PHP, Phyton, Ruby, C#, …) Selenium RC Browsers Web-application HTTP
  • 7. Selenium 2.0 Architecture 7 www.ExigenServices.com Autotests Driver Browsers Web-application API to control the browser
  • 8. Advantages of Selenium 2.0 • The development and connection of new drivers, adapted to the specific test environment • A more "advanced" API for writing tests • Events generated are the same as for manual testing • Work with invisible elements is not available 8 www.ExigenServices.com
  • 9. Disadvantages of Selenium 2.0 • Need to create own webdriver for each test 9 www.ExigenServices.com environment • Only 4 programming languages are supported
  • 10. 10 www.ExigenServices.com WebDriver WebDriver’s Drivers •HtmlUnit Driver •Firefox Driver •Internet Explorer Driver •Chrome Driver •Opera Driver •iPhone Driver •Android Driver
  • 11. WebDriver driver = new FirefoxDriver(); 11 www.ExigenServices.com Selenium API WebDriver – to control the browser WebElement – to work with the elements on the page WebElement element = driver.findElement(By.id(“id”));
  • 12. 12 www.ExigenServices.com WebDriver API  void get(java.lang.String url) – open page  void quit() – close browser  WebDriver.TargetLocator switchTo() – switching between the popup-E, alert, windows  WebElement findElement(By by) -– find element by locator  List<WebElement> findElements(By by) – find elements by locator
  • 13. Selenium API: Find elements 13 www.ExigenServices.com  By.id("idOfObject")  By.linkText("TextUsedInTheLink")  By.partialLinkText("partOfThelink")  By.tagName("theHTMLNodeType")  By.className("cssClassOnTheElement")  By.cssSelector("cssSelectorToTheElement")  By.xpath("//Xpath/to/the/element")  By.name("nameOfElement")
  • 14. Selenium API: Find elements 14 www.ExigenServices.com Tools for finding elements: 1. Firebug. Download firebug at http://getfirebug.com/ 2. Firefinder for Firebug
  • 15. Selenium API: Find elements http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#selectors 15 www.ExigenServices.com
  • 16. Selenium API: Basic operations on elements 16 www.ExigenServices.com  void click()  void submit()  String getValue()  void sendKeys(keysToSend)  void clear()  String getElementName()  String getAttribute(java.lang.String name)  boolean toggle()
  • 17. 17 www.ExigenServices.com Selenium API: Waits Implicit Waits Explicit Waits
  • 18. Working with windows 18 www.ExigenServices.com  Working with browser windows driver.getWindowHandles() driver.switchTo().window(windowName)  Working with frames driver.switchTo().frame( "frameName" );  Working with alerts driver.switchTo().alert();
  • 19. 19 www.ExigenServices.com Create tests 1. Java http://java.com/ru/download 2. IDE 3. Library Selenium WebDriver http://seleniumhq.org/download/ 4. Firebug
  • 20. 20 www.ExigenServices.com Create test Test Case: Selenium is in the first line of request for rambler search Condition: Browser is open Steps: 1. Enter “selenium webdriver” into search request 2. Press search button Expected result: The first line of request must be a link to the official Selenium website
  • 21. 21 www.ExigenServices.com Create test public class Rambler { protected WebDriver driver; @Before public void setUp() throws Exception { System.out.println("tmp"); // driver = new FirefoxDriver(); driver = new InternetExplorerDriver(); driver.get("http://www.rambler.ru/"); }
  • 22. 22 www.ExigenServices.com Create test @Test public void RamblerSearch() throws Exception { System.out.println(" TC: Selenium is in the first line of request for rambler search"); waitUntilDisplayed(By.cssSelector(Constants.txtRambler)); driver.findElement(By.cssSelector(Constants.txtRambler)).sendKeys("selenium webdriver"); driver.findElement(By.className("pointer")).click(); //wait first result waitUntilDisplayed(By.cssSelector("div[class='b-left-column__wrapper']")); assertTrue(driver.findElement(By.cssSelector("div[class='b-podmes_books b-podmes_ top_1']")).getText().contains("Selenium - Web Browser Automation")); }
  • 23. 23 www.ExigenServices.com Create test public class Constants { public static final String txtRambler = "input[class='r--hat-form-text-input']"; }
  • 24. 24 www.ExigenServices.com Create test @Test public void RamblerSearch() throws Exception { System.out.println(" TC: Selenium is in the first line of request for rambler search"); waitUntilDisplayed(By.cssSelector(Constants.txtRambler)); driver.findElement(By.cssSelector(Constants.txtRambler)).sendKeys("selenium webdriver"); driver.findElement(By.className("pointer")).click(); //wait first result waitUntilDisplayed(By.cssSelector("div[class='b-left-column__wrapper']")); assertTrue(driver.findElement(By.cssSelector("div[class='b-podmes_books b-podmes_ top_1']")).getText().contains("Selenium - Web Browser Automation")); }
  • 25. 25 www.ExigenServices.com Create test public void waitUntilDisplayed(final By locator) { ( new WebDriverWait(driver, 120)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return d.findElement(locator).isDisplayed(); } }); } @After public void tearDown() throws Exception { //close browser driver.quit(); }
  • 28. 28 www.ExigenServices.com Structure of the test 1. Use Set UP () and tearDown() 2. All tests should finish with assertion 3. Elements’ locators should be defined in separate class
  • 29. 30 www.ExigenServices.com Useful links • http://seleniumhq.org/docs/ • http://software-testing.ru/library/testing/functional-testing/ 1398-selenium-20 • http://automated-testing. info/knowledgebase/avtomatizaciya-funkcionalnogo- testirovaniya/selenium • http://autotestgroup.com/ru/ • http://www.w3.org/TR/2001/CR-css3-selectors- 20011113/#selectors • http://junit.org