SlideShare a Scribd company logo
Test Web applicationsTest Web applications
using Seleniumusing Selenium
Design By :- Vibrant Technologies
& computers
OutlineOutline
• Uniqueness of web app testing
o Heterogonous system
o Dynamic pages
o Load
o Security
• Selenium WebDriver
• Course project 4
Web application architectureWeb application architecture
• Heterogeneous system
o Front end
• Browser: IE, Firefox,
Chrome, Safari…
o Server side
• Application Server
• Database Server
• File System
• ……
Heterogeneous systemHeterogeneous system
HTMHTM
JavaScrptJavaScrpt
Page in BrowserPage in Browser
Source behindSource behind
Uniqueness 1: Heterogeneous systemUniqueness 1: Heterogeneous system
• Server side
o Can be written in PHP, Java, C#...
o Communicate with Database server in SQL
PHP ScriptPHP Script
SQLSQL
HTMLHTML
SQLSQL
PHPPHP
Heterogeneous systemHeterogeneous system
• Should test all involved parts
o Everything can go wrong…
• However, only front end is accessible for tests
o Can not directly test the Server code and SQL
o Have to drive the execution and test
• Frontend
o HTML: Malformed HTML page? (demo)
o JavaScript: Runtime Errors? (demo)
• Server script
o PHP, Java…: Runtime Errors? (demo)
o SQL: Malformed SQL query string? (demo)
Test from the front endTest from the front end
• Good things
o Hide the complexity of the backend
o Uniformed interface
o Can put a robot in the front end and automate the tests
 Bad things
o The front end is not trustable
• Crafted malicious requests
Good things of testing from the front endGood things of testing from the front end
• Automated web app testing
o Compare to commend-line program testing…
• Sensitive to input values (the same)
• GUI testing: event driven (the difference)
o “Button A” then “Button B”  OK
o “Button B” then “Button A”  FAIL
o The robot should be able to
• Provide input values
• Simulate user actions
• Selenium
o A tool set automates web app testing across platforms
o Can simulate user interactions in browser
o Two components
• Selenium IDE
• Selenium WebDriver (aka. Selenium 2)
Selenium IDESelenium IDE
• Firefox extension
• Easy record and replay
• Debug and set breakpoints
• Save tests in HTML,
WebDriver and other
formats.
Selenium IDE test casesSelenium IDE test cases
• Selenium saves all information in an HTML table format
• Each record consists of:
o Command – tells Selenium what to do (e.g. “open”, “type”,
“click”, “verifyText”)
o Target – tells Selenium which HTML element a command refers to
(e.g. textbox, header, table)
o Value – used for any command that might need a value of some
kind (e.g. type something into a textbox)
How to record/replay with Selenium IDEHow to record/replay with Selenium IDE
1. Start recording in Selenium IDE
2. Execute scenario on running web application
3. Stop recording in Selenium IDE
4. Verify / Add assertions
5. Replay the test.
Selenium IDE Demo……
Bad things of testing from the front endBad things of testing from the front end
• The front end is not trustable
o Front end code can be accessed to anybody
o They can infer the input parameters
o Crafted requests!
• Demo
o Front end limits the length of the input values
o Front end limits the content of the input values
o Front end limits the combination of the input values
Uniqueness 2: Dynamic pagesUniqueness 2: Dynamic pages
• Client page is dynamic
o It can change itself in the runtime
o HTML can be modified by JavaScript
o JavaScript can modify itself
o Demo
• Server script is dynamic
o Client pages are constructed in the runtime
o A same server script can produce completely different client pages
o Demo
• SchoolMate
Uniqueness 3: PerformanceUniqueness 3: Performance
• Performance is crucial to the success of a web app
o Recall the experience to register for a class in the first days of the semester…
o Are the servers powerful enough?
• Performance testing evaluates system performance under normal and
heavy usage
o Load testing
• For expected concurrent number of users
o Stress testing
• To understand the upper limits of capacity
• Performance testing can be automated
Uniqueness 4: SecurityUniqueness 4: Security
• Web app usually deals with sensitive info, e.g.
o Credit card number
o SSN
o Billing / Shipping address
• Security is the biggest concern
• Security testing should simulate possible attacks
Uniqueness 4: SecurityUniqueness 4: Security
• SQL Injection
o The untrusted input is used to construct dynamic SQL queries.
o E.g, update my own password
$str = "UPDATE users SET password = ” “ . $_POST['newPass’] .
“” WHERE username =”“ . $_POST['username'] . “””;
mysql_query( $str );
$_POST['newPass’] = pass, $_POST['username'] = me
Query String: UPDATE users SET password = “pass” WHERE username =“me”
$_POST['newPass’] = pass, $_POST['username'] = “ OR 1=1 --
Query String: UPDATE users SET password = “pass” WHERE username =“” OR 1=1 --”
Normal CaseNormal Case
AttackAttack
PHP ScriptPHP Script
Uniqueness 4: SecurityUniqueness 4: Security
• Cross Site Scripting (XSS)
o The untrusted input is used to construct dynamic HTML pages.
o The malicious JS injected executes in victim’s browser
o The malicious JS can steal sensitive info
o Demo
• Solution: Never trust user inputs
• Design test cases to simulate attacks
OutlineOutline
• Uniqueness of web app testing
o Heterogonous system
o Dynamic pages
o Load
o Security
• Selenium WebDriver
• Course project 4
Limitation of Selenium IDELimitation of Selenium IDE
• No multiple browsers support
o It runs only in Mozilla Firefox.
• No manual scripts
o E.g. conditions and Loops for Data Driven Testing
• Fancy test cases  Selenium WebDriver
Selenium WebDriver (Selenium 2)Selenium WebDriver (Selenium 2)
• Selenium-WebDriver
o A piece of program
o Control the browser by programming
o More flexible and powerful
• Selenium-WebDriver supports multiple browsers in multiple
platforms
o Google Chrome 12.0.712.0+
o Internet Explorer 6+
o Firefox 3.0+
o Opera 11.5+
o Android – 2.3+ for phones and tablets
o iOS 3+ for phones
o iOS 3.2+ for tablets
Selenium WebDriverSelenium WebDriver
• WebDriver is designed to providing a simpler and
uniformed programming interface
o Same WebDriver script runs for different platforms
• Support multiple programming language:
o Java, C#, Python, Ruby, PHP, Perl…
• It’s efficient
o WebDriver leverages each browser’s native support for automation.
What Selenium can doWhat Selenium can do
• A solution for the automated testing
o Simulate user actions
o Functional testing
• Create regression tests to verify functionality and user acceptance.
o Browser compatibility testing
• The same script can run on any Selenium platform
o Load testing
o Stress testing
How to use Selenium WebDriverHow to use Selenium WebDriver
(1) Go to a page
(2) Locate an element
(3) Do something with that element
......
(i) Locate an element
(i+1) Do something with that element
(i+2) Verify / Assert the result
DemoDemo: Verify page title: Verify page titlepublic static void main( String[] args )
{
// Create a new instance of the Firefox driver
WebDriver driver = new FirefoxDriver();
// (1) Go to a page
driver.get("http://www.google.com");
// (2) Locate an element
WebElement element = driver.findElement(By.name("q"));
// (3-1) Enter something to search for
element.sendKeys("Purdue Univeristy");
// (3-2) Now submit the form. WebDriver will find the form for us from the element
element.submit();
// (3-3) Wait up to 10 seconds for a condition
WebDriverWait waiting = new WebDriverWait(driver, 10);
waiting.until( ExpectedConditions.presenceOfElementLocated( By.id("pnnext") ) );
// (4) Check the title of the page
if( driver.getTitle().equals("purdue univeristy - Google Search") )
System.out.println("PASS");
else
System.err.println("FAIL");
//Close the browser
driver.quit();
}
How to locate an elementHow to locate an element
• By id
o HTML: <div id="coolestWidgetEvah">...</div>
o WebDriver:
driver.findElement( By.id("coolestWidgetEvah") );
• By name
o HTML: <input name="cheese" type="text"/>
o WebDriver: driver.findElement( By.name("cheese") );
• By Xpath
o HTML
<html>
<input type="text" name="example" />
<input type="text" name="other" />
</html>
o WebDriver: driver.findElements( By.xpath("//input") );
o There are plug-ins for firefox/chrome to automatically display the Xpath
Time issueTime issue
• There are delays between submitting a request and receiving the
response
• We can wait until the response page is loaded
• Robot doesn’t know!
• In WebDriver, sometimes it doesn’t work if
o Submit a request
o Verify the response immediately
• Solution:
o Simulate the wait. Wait until some HTML object appears
o Demo
OutlineOutline
• What to test for a web application
• Test web app with selenium
o What’s Selenium?
o Why Selenium?
o How to use Selenium
• Course project 4
Course Project 4Course Project 4
• Test a functionality
without the source
• The subject web
application
o “Add New Class” in
“SchoolMate”
Course Project 4Course Project 4
• Part 1: overview
o Design test cases against the requirement
• The tests should consider
o all possible cases
o equivalence class partitioning
o Implement Selenium WebDriver Script for “Add new class”
Your testYour test
casescases
Your testYour test
casescases
Your WebDriverYour WebDriver
test templatetest template
Your WebDriverYour WebDriver
test templatetest template
inputinputinputinput outputoutputoutputoutput
TestTest
resultsresults
TestTest
resultsresults
Part 1: requirement analysisPart 1: requirement analysis
• Requirement for values
entered/selected
o [R-1] Class Name : alphabets
and numbers are allowed.
o [R-2] Section Number : only
numbers are allowed.
o [R-3] Room Number : only
numbers are allowed.
o [R-4] Period Number : only
numbers are allowed.
o [R-5] All textbox fields : no
Cross-Site Scripting (XSS)
injection vulnerabilities.
Part 1: requirement analysisPart 1: requirement analysis
• Requirement for the “add” function
• After clicking the “Add class” button…
o [R-6] The class record added is successfully shown in the table.
o [R-7] The values are exactly the same as those were entered or selected.
Part 1:Design testcasesPart 1:Design testcases
• For each requirement, design test cases
• Only need test one field in each case
o Do not need consider combinations of fileds
• E.g.
o [R-1] Class Name : alphabets and numbers are allowed.
o You need consider all possible cases
o Divide the test space and find the equivalence class
• Alphabets
• Numbers
• ….
• The test case format is defined
o Test cases will be used as input to your WebDriver Script
Part 1: Implement WebDriver ScriptPart 1: Implement WebDriver Script
• In WebDriver script, Simulate the user action
o Navigate to the subject page
o Enter values into textboxs based on input values
o Select options based on input values
o Click the “add class” button
o Check the result against the requirements
• Run all your test cases and report the results.
Course Project 4Course Project 4
• Part 2: Pair wise testing
o Use an existing pair wise testing tool fire-eye
o Largely you may reuse the WebDriver template in
Part 1
Your testYour test
casescases
Your testYour test
casescases
Your WebDriverYour WebDriver
test templatetest template
Your WebDriverYour WebDriver
test templatetest template
inputinputinputinput outputoutputoutputoutput
TestTest
resultresult
TestTest
resultresult
Test casesTest cases
generatedgenerated
Test casesTest cases
generatedgenerated
ConvertConvertConvertConvert
Part 2: Generate test casesPart 2: Generate test cases
• Consider the combination of all textboxs/options
• Use the existing tool, fire-eye, to generate test cases
• Export the test case in “Nist form”
• Parse and convert the exported test cases to the form
that your WebDriver can accept
• Run all pair-wise test cases
• Report the result
Part 2: Solution designPart 2: Solution design
• Selenium can do more …
• Black Friday is coming, hot items can be sold in a few seconds
• Can you leverage the automated tool and design a practical solution to score a super
hot deal?
• Explain
o What’s the challenge
o What’s the possible cases to handle and how?
• In stock
• Out of stock
• Your shopping cart may be reset under what conditions…
o How to add it into your shopping cart asap
o How you are going to cooperate with the automated tool
ThankThank You !!!You !!!
For More Information click below link:
Follow Us on:
http://vibranttechnologies.co.in/selenium-classes-in-mu

More Related Content

What's hot

Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using RubyKumari Warsha Goel
 
Basic Selenium Training
Basic Selenium TrainingBasic Selenium Training
Basic Selenium Training
Dipesh Bhatewara
 
Selenide
SelenideSelenide
Selenide
DataArt
 
Selenide
SelenideSelenide
Expert selenium with core java
Expert selenium with core javaExpert selenium with core java
Expert selenium with core java
Ishita Arora
 
Automated Testing With Watir
Automated Testing With WatirAutomated Testing With Watir
Automated Testing With Watir
Timothy Fisher
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summary
Alan Richardson
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and Beyond
Alan Richardson
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
Seth McLaughlin
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotInterview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlot
Learning Slot
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & Tricks
Addy Osmani
 
Hacking Wordpress Plugins
Hacking Wordpress PluginsHacking Wordpress Plugins
Hacking Wordpress Plugins
Larry Cashdollar
 
Intro to Pentesting Jenkins
Intro to Pentesting JenkinsIntro to Pentesting Jenkins
Intro to Pentesting Jenkins
Brian Hysell
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
Praveen Gorantla
 
Pentesting Modern Web Apps: A Primer
Pentesting Modern Web Apps: A PrimerPentesting Modern Web Apps: A Primer
Pentesting Modern Web Apps: A Primer
Brian Hysell
 
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlotInterview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Learning Slot
 
Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)
Mindfire Solutions
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
Return on Intelligence
 
Tellurium.A.New.Approach.For.Web.Testing
Tellurium.A.New.Approach.For.Web.TestingTellurium.A.New.Approach.For.Web.Testing
Tellurium.A.New.Approach.For.Web.Testing
John.Jian.Fang
 
Tellurium At Rich Web Experience2009
Tellurium At Rich Web Experience2009Tellurium At Rich Web Experience2009
Tellurium At Rich Web Experience2009
John.Jian.Fang
 

What's hot (20)

Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 
Basic Selenium Training
Basic Selenium TrainingBasic Selenium Training
Basic Selenium Training
 
Selenide
SelenideSelenide
Selenide
 
Selenide
SelenideSelenide
Selenide
 
Expert selenium with core java
Expert selenium with core javaExpert selenium with core java
Expert selenium with core java
 
Automated Testing With Watir
Automated Testing With WatirAutomated Testing With Watir
Automated Testing With Watir
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summary
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and Beyond
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotInterview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlot
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & Tricks
 
Hacking Wordpress Plugins
Hacking Wordpress PluginsHacking Wordpress Plugins
Hacking Wordpress Plugins
 
Intro to Pentesting Jenkins
Intro to Pentesting JenkinsIntro to Pentesting Jenkins
Intro to Pentesting Jenkins
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
Pentesting Modern Web Apps: A Primer
Pentesting Modern Web Apps: A PrimerPentesting Modern Web Apps: A Primer
Pentesting Modern Web Apps: A Primer
 
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlotInterview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
 
Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Tellurium.A.New.Approach.For.Web.Testing
Tellurium.A.New.Approach.For.Web.TestingTellurium.A.New.Approach.For.Web.Testing
Tellurium.A.New.Approach.For.Web.Testing
 
Tellurium At Rich Web Experience2009
Tellurium At Rich Web Experience2009Tellurium At Rich Web Experience2009
Tellurium At Rich Web Experience2009
 

Similar to Selenium testing - Handle Elements in WebDriver

Selenium
SeleniumSelenium
Selenium
Sun Technlogies
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
rajnexient
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
ssuser7b4894
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
AmenSheikh
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Dave Haeffner
 
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 use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
TEST Huddle
 
Selenium Automation
Selenium AutomationSelenium Automation
Selenium Automation
Anuradha Malalasena
 
Whys and Hows of Automation
Whys and Hows of AutomationWhys and Hows of Automation
Whys and Hows of Automation
vodQA
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
orbitprojects
 
full-stack-webapp-testing-with-selenium-and-rails.pdf
full-stack-webapp-testing-with-selenium-and-rails.pdffull-stack-webapp-testing-with-selenium-and-rails.pdf
full-stack-webapp-testing-with-selenium-and-rails.pdf
Brian Takita
 
Cross platform browser automation tests sdp
Cross platform browser automation tests   sdpCross platform browser automation tests   sdp
Cross platform browser automation tests sdp
Oren Ashkenazy
 
Selenium training
Selenium trainingSelenium training
Selenium training
Shivaraj R
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
Agile Testing Alliance
 
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsSelenium Basics by Quontra Solutions
Selenium Basics by Quontra Solutions
QUONTRASOLUTIONS
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
Dave Haeffner
 
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A CookbookJavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
Jorge Hidalgo
 
Selenium for everyone
Selenium for everyoneSelenium for everyone
Selenium for everyone
Tft Us
 
Web testing with selenium and by quontra solutions
Web testing with selenium and  by quontra solutionsWeb testing with selenium and  by quontra solutions
Web testing with selenium and by quontra solutions
QUONTRASOLUTIONS
 

Similar to Selenium testing - Handle Elements in WebDriver (20)

Selenium
SeleniumSelenium
Selenium
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
 
selenium.ppt
selenium.pptselenium.ppt
selenium.ppt
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
 
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 use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
Selenium Automation
Selenium AutomationSelenium Automation
Selenium Automation
 
Whys and Hows of Automation
Whys and Hows of AutomationWhys and Hows of Automation
Whys and Hows of Automation
 
Selenium Concepts
Selenium ConceptsSelenium Concepts
Selenium Concepts
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
full-stack-webapp-testing-with-selenium-and-rails.pdf
full-stack-webapp-testing-with-selenium-and-rails.pdffull-stack-webapp-testing-with-selenium-and-rails.pdf
full-stack-webapp-testing-with-selenium-and-rails.pdf
 
Cross platform browser automation tests sdp
Cross platform browser automation tests   sdpCross platform browser automation tests   sdp
Cross platform browser automation tests sdp
 
Selenium training
Selenium trainingSelenium training
Selenium training
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsSelenium Basics by Quontra Solutions
Selenium Basics by Quontra Solutions
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A CookbookJavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
JavaOne 2016 - CON3080 - Testing Java Web Applications with Selenium: A Cookbook
 
Selenium for everyone
Selenium for everyoneSelenium for everyone
Selenium for everyone
 
Web testing with selenium and by quontra solutions
Web testing with selenium and  by quontra solutionsWeb testing with selenium and  by quontra solutions
Web testing with selenium and by quontra solutions
 

More from Vibrant Technologies & Computers

Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5
Vibrant Technologies & Computers
 
SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables  SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables
Vibrant Technologies & Computers
 
SQL- Introduction to MySQL
SQL- Introduction to MySQLSQL- Introduction to MySQL
SQL- Introduction to MySQL
Vibrant Technologies & Computers
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
Vibrant Technologies & Computers
 
ITIL - introduction to ITIL
ITIL - introduction to ITILITIL - introduction to ITIL
ITIL - introduction to ITIL
Vibrant Technologies & Computers
 
Salesforce - Introduction to Security & Access
Salesforce -  Introduction to Security & Access Salesforce -  Introduction to Security & Access
Salesforce - Introduction to Security & Access
Vibrant Technologies & Computers
 
Data ware housing- Introduction to olap .
Data ware housing- Introduction to  olap .Data ware housing- Introduction to  olap .
Data ware housing- Introduction to olap .
Vibrant Technologies & Computers
 
Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.
Vibrant Technologies & Computers
 
Data ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housingData ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housing
Vibrant Technologies & Computers
 
Salesforce - classification of cloud computing
Salesforce - classification of cloud computingSalesforce - classification of cloud computing
Salesforce - classification of cloud computing
Vibrant Technologies & Computers
 
Salesforce - cloud computing fundamental
Salesforce - cloud computing fundamentalSalesforce - cloud computing fundamental
Salesforce - cloud computing fundamental
Vibrant Technologies & Computers
 
SQL- Introduction to PL/SQL
SQL- Introduction to  PL/SQLSQL- Introduction to  PL/SQL
SQL- Introduction to PL/SQL
Vibrant Technologies & Computers
 
SQL- Introduction to advanced sql concepts
SQL- Introduction to  advanced sql conceptsSQL- Introduction to  advanced sql concepts
SQL- Introduction to advanced sql concepts
Vibrant Technologies & Computers
 
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data   SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
Vibrant Technologies & Computers
 
SQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set OperationsSQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set Operations
Vibrant Technologies & Computers
 
Sas - Introduction to designing the data mart
Sas - Introduction to designing the data martSas - Introduction to designing the data mart
Sas - Introduction to designing the data mart
Vibrant Technologies & Computers
 
Sas - Introduction to working under change management
Sas - Introduction to working under change managementSas - Introduction to working under change management
Sas - Introduction to working under change management
Vibrant Technologies & Computers
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
Vibrant Technologies & Computers
 
Teradata - Architecture of Teradata
Teradata - Architecture of TeradataTeradata - Architecture of Teradata
Teradata - Architecture of Teradata
Vibrant Technologies & Computers
 
Teradata - Restoring Data
Teradata - Restoring Data Teradata - Restoring Data
Teradata - Restoring Data
Vibrant Technologies & Computers
 

More from Vibrant Technologies & Computers (20)

Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5
 
SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables  SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables
 
SQL- Introduction to MySQL
SQL- Introduction to MySQLSQL- Introduction to MySQL
SQL- Introduction to MySQL
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
 
ITIL - introduction to ITIL
ITIL - introduction to ITILITIL - introduction to ITIL
ITIL - introduction to ITIL
 
Salesforce - Introduction to Security & Access
Salesforce -  Introduction to Security & Access Salesforce -  Introduction to Security & Access
Salesforce - Introduction to Security & Access
 
Data ware housing- Introduction to olap .
Data ware housing- Introduction to  olap .Data ware housing- Introduction to  olap .
Data ware housing- Introduction to olap .
 
Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.
 
Data ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housingData ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housing
 
Salesforce - classification of cloud computing
Salesforce - classification of cloud computingSalesforce - classification of cloud computing
Salesforce - classification of cloud computing
 
Salesforce - cloud computing fundamental
Salesforce - cloud computing fundamentalSalesforce - cloud computing fundamental
Salesforce - cloud computing fundamental
 
SQL- Introduction to PL/SQL
SQL- Introduction to  PL/SQLSQL- Introduction to  PL/SQL
SQL- Introduction to PL/SQL
 
SQL- Introduction to advanced sql concepts
SQL- Introduction to  advanced sql conceptsSQL- Introduction to  advanced sql concepts
SQL- Introduction to advanced sql concepts
 
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data   SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
 
SQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set OperationsSQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set Operations
 
Sas - Introduction to designing the data mart
Sas - Introduction to designing the data martSas - Introduction to designing the data mart
Sas - Introduction to designing the data mart
 
Sas - Introduction to working under change management
Sas - Introduction to working under change managementSas - Introduction to working under change management
Sas - Introduction to working under change management
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
 
Teradata - Architecture of Teradata
Teradata - Architecture of TeradataTeradata - Architecture of Teradata
Teradata - Architecture of Teradata
 
Teradata - Restoring Data
Teradata - Restoring Data Teradata - Restoring Data
Teradata - Restoring Data
 

Recently uploaded

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 

Recently uploaded (20)

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 

Selenium testing - Handle Elements in WebDriver

  • 1.
  • 2. Test Web applicationsTest Web applications using Seleniumusing Selenium Design By :- Vibrant Technologies & computers
  • 3. OutlineOutline • Uniqueness of web app testing o Heterogonous system o Dynamic pages o Load o Security • Selenium WebDriver • Course project 4
  • 4. Web application architectureWeb application architecture • Heterogeneous system o Front end • Browser: IE, Firefox, Chrome, Safari… o Server side • Application Server • Database Server • File System • ……
  • 5. Heterogeneous systemHeterogeneous system HTMHTM JavaScrptJavaScrpt Page in BrowserPage in Browser Source behindSource behind
  • 6. Uniqueness 1: Heterogeneous systemUniqueness 1: Heterogeneous system • Server side o Can be written in PHP, Java, C#... o Communicate with Database server in SQL PHP ScriptPHP Script SQLSQL HTMLHTML SQLSQL PHPPHP
  • 7. Heterogeneous systemHeterogeneous system • Should test all involved parts o Everything can go wrong… • However, only front end is accessible for tests o Can not directly test the Server code and SQL o Have to drive the execution and test • Frontend o HTML: Malformed HTML page? (demo) o JavaScript: Runtime Errors? (demo) • Server script o PHP, Java…: Runtime Errors? (demo) o SQL: Malformed SQL query string? (demo)
  • 8. Test from the front endTest from the front end • Good things o Hide the complexity of the backend o Uniformed interface o Can put a robot in the front end and automate the tests  Bad things o The front end is not trustable • Crafted malicious requests
  • 9. Good things of testing from the front endGood things of testing from the front end • Automated web app testing o Compare to commend-line program testing… • Sensitive to input values (the same) • GUI testing: event driven (the difference) o “Button A” then “Button B”  OK o “Button B” then “Button A”  FAIL o The robot should be able to • Provide input values • Simulate user actions • Selenium o A tool set automates web app testing across platforms o Can simulate user interactions in browser o Two components • Selenium IDE • Selenium WebDriver (aka. Selenium 2)
  • 10. Selenium IDESelenium IDE • Firefox extension • Easy record and replay • Debug and set breakpoints • Save tests in HTML, WebDriver and other formats.
  • 11. Selenium IDE test casesSelenium IDE test cases • Selenium saves all information in an HTML table format • Each record consists of: o Command – tells Selenium what to do (e.g. “open”, “type”, “click”, “verifyText”) o Target – tells Selenium which HTML element a command refers to (e.g. textbox, header, table) o Value – used for any command that might need a value of some kind (e.g. type something into a textbox)
  • 12. How to record/replay with Selenium IDEHow to record/replay with Selenium IDE 1. Start recording in Selenium IDE 2. Execute scenario on running web application 3. Stop recording in Selenium IDE 4. Verify / Add assertions 5. Replay the test. Selenium IDE Demo……
  • 13. Bad things of testing from the front endBad things of testing from the front end • The front end is not trustable o Front end code can be accessed to anybody o They can infer the input parameters o Crafted requests! • Demo o Front end limits the length of the input values o Front end limits the content of the input values o Front end limits the combination of the input values
  • 14. Uniqueness 2: Dynamic pagesUniqueness 2: Dynamic pages • Client page is dynamic o It can change itself in the runtime o HTML can be modified by JavaScript o JavaScript can modify itself o Demo • Server script is dynamic o Client pages are constructed in the runtime o A same server script can produce completely different client pages o Demo • SchoolMate
  • 15. Uniqueness 3: PerformanceUniqueness 3: Performance • Performance is crucial to the success of a web app o Recall the experience to register for a class in the first days of the semester… o Are the servers powerful enough? • Performance testing evaluates system performance under normal and heavy usage o Load testing • For expected concurrent number of users o Stress testing • To understand the upper limits of capacity • Performance testing can be automated
  • 16. Uniqueness 4: SecurityUniqueness 4: Security • Web app usually deals with sensitive info, e.g. o Credit card number o SSN o Billing / Shipping address • Security is the biggest concern • Security testing should simulate possible attacks
  • 17. Uniqueness 4: SecurityUniqueness 4: Security • SQL Injection o The untrusted input is used to construct dynamic SQL queries. o E.g, update my own password $str = "UPDATE users SET password = ” “ . $_POST['newPass’] . “” WHERE username =”“ . $_POST['username'] . “””; mysql_query( $str ); $_POST['newPass’] = pass, $_POST['username'] = me Query String: UPDATE users SET password = “pass” WHERE username =“me” $_POST['newPass’] = pass, $_POST['username'] = “ OR 1=1 -- Query String: UPDATE users SET password = “pass” WHERE username =“” OR 1=1 --” Normal CaseNormal Case AttackAttack PHP ScriptPHP Script
  • 18. Uniqueness 4: SecurityUniqueness 4: Security • Cross Site Scripting (XSS) o The untrusted input is used to construct dynamic HTML pages. o The malicious JS injected executes in victim’s browser o The malicious JS can steal sensitive info o Demo • Solution: Never trust user inputs • Design test cases to simulate attacks
  • 19. OutlineOutline • Uniqueness of web app testing o Heterogonous system o Dynamic pages o Load o Security • Selenium WebDriver • Course project 4
  • 20. Limitation of Selenium IDELimitation of Selenium IDE • No multiple browsers support o It runs only in Mozilla Firefox. • No manual scripts o E.g. conditions and Loops for Data Driven Testing • Fancy test cases  Selenium WebDriver
  • 21. Selenium WebDriver (Selenium 2)Selenium WebDriver (Selenium 2) • Selenium-WebDriver o A piece of program o Control the browser by programming o More flexible and powerful • Selenium-WebDriver supports multiple browsers in multiple platforms o Google Chrome 12.0.712.0+ o Internet Explorer 6+ o Firefox 3.0+ o Opera 11.5+ o Android – 2.3+ for phones and tablets o iOS 3+ for phones o iOS 3.2+ for tablets
  • 22. Selenium WebDriverSelenium WebDriver • WebDriver is designed to providing a simpler and uniformed programming interface o Same WebDriver script runs for different platforms • Support multiple programming language: o Java, C#, Python, Ruby, PHP, Perl… • It’s efficient o WebDriver leverages each browser’s native support for automation.
  • 23. What Selenium can doWhat Selenium can do • A solution for the automated testing o Simulate user actions o Functional testing • Create regression tests to verify functionality and user acceptance. o Browser compatibility testing • The same script can run on any Selenium platform o Load testing o Stress testing
  • 24. How to use Selenium WebDriverHow to use Selenium WebDriver (1) Go to a page (2) Locate an element (3) Do something with that element ...... (i) Locate an element (i+1) Do something with that element (i+2) Verify / Assert the result
  • 25. DemoDemo: Verify page title: Verify page titlepublic static void main( String[] args ) { // Create a new instance of the Firefox driver WebDriver driver = new FirefoxDriver(); // (1) Go to a page driver.get("http://www.google.com"); // (2) Locate an element WebElement element = driver.findElement(By.name("q")); // (3-1) Enter something to search for element.sendKeys("Purdue Univeristy"); // (3-2) Now submit the form. WebDriver will find the form for us from the element element.submit(); // (3-3) Wait up to 10 seconds for a condition WebDriverWait waiting = new WebDriverWait(driver, 10); waiting.until( ExpectedConditions.presenceOfElementLocated( By.id("pnnext") ) ); // (4) Check the title of the page if( driver.getTitle().equals("purdue univeristy - Google Search") ) System.out.println("PASS"); else System.err.println("FAIL"); //Close the browser driver.quit(); }
  • 26. How to locate an elementHow to locate an element • By id o HTML: <div id="coolestWidgetEvah">...</div> o WebDriver: driver.findElement( By.id("coolestWidgetEvah") ); • By name o HTML: <input name="cheese" type="text"/> o WebDriver: driver.findElement( By.name("cheese") ); • By Xpath o HTML <html> <input type="text" name="example" /> <input type="text" name="other" /> </html> o WebDriver: driver.findElements( By.xpath("//input") ); o There are plug-ins for firefox/chrome to automatically display the Xpath
  • 27. Time issueTime issue • There are delays between submitting a request and receiving the response • We can wait until the response page is loaded • Robot doesn’t know! • In WebDriver, sometimes it doesn’t work if o Submit a request o Verify the response immediately • Solution: o Simulate the wait. Wait until some HTML object appears o Demo
  • 28. OutlineOutline • What to test for a web application • Test web app with selenium o What’s Selenium? o Why Selenium? o How to use Selenium • Course project 4
  • 29. Course Project 4Course Project 4 • Test a functionality without the source • The subject web application o “Add New Class” in “SchoolMate”
  • 30. Course Project 4Course Project 4 • Part 1: overview o Design test cases against the requirement • The tests should consider o all possible cases o equivalence class partitioning o Implement Selenium WebDriver Script for “Add new class” Your testYour test casescases Your testYour test casescases Your WebDriverYour WebDriver test templatetest template Your WebDriverYour WebDriver test templatetest template inputinputinputinput outputoutputoutputoutput TestTest resultsresults TestTest resultsresults
  • 31. Part 1: requirement analysisPart 1: requirement analysis • Requirement for values entered/selected o [R-1] Class Name : alphabets and numbers are allowed. o [R-2] Section Number : only numbers are allowed. o [R-3] Room Number : only numbers are allowed. o [R-4] Period Number : only numbers are allowed. o [R-5] All textbox fields : no Cross-Site Scripting (XSS) injection vulnerabilities.
  • 32. Part 1: requirement analysisPart 1: requirement analysis • Requirement for the “add” function • After clicking the “Add class” button… o [R-6] The class record added is successfully shown in the table. o [R-7] The values are exactly the same as those were entered or selected.
  • 33. Part 1:Design testcasesPart 1:Design testcases • For each requirement, design test cases • Only need test one field in each case o Do not need consider combinations of fileds • E.g. o [R-1] Class Name : alphabets and numbers are allowed. o You need consider all possible cases o Divide the test space and find the equivalence class • Alphabets • Numbers • …. • The test case format is defined o Test cases will be used as input to your WebDriver Script
  • 34. Part 1: Implement WebDriver ScriptPart 1: Implement WebDriver Script • In WebDriver script, Simulate the user action o Navigate to the subject page o Enter values into textboxs based on input values o Select options based on input values o Click the “add class” button o Check the result against the requirements • Run all your test cases and report the results.
  • 35. Course Project 4Course Project 4 • Part 2: Pair wise testing o Use an existing pair wise testing tool fire-eye o Largely you may reuse the WebDriver template in Part 1 Your testYour test casescases Your testYour test casescases Your WebDriverYour WebDriver test templatetest template Your WebDriverYour WebDriver test templatetest template inputinputinputinput outputoutputoutputoutput TestTest resultresult TestTest resultresult Test casesTest cases generatedgenerated Test casesTest cases generatedgenerated ConvertConvertConvertConvert
  • 36. Part 2: Generate test casesPart 2: Generate test cases • Consider the combination of all textboxs/options • Use the existing tool, fire-eye, to generate test cases • Export the test case in “Nist form” • Parse and convert the exported test cases to the form that your WebDriver can accept • Run all pair-wise test cases • Report the result
  • 37. Part 2: Solution designPart 2: Solution design • Selenium can do more … • Black Friday is coming, hot items can be sold in a few seconds • Can you leverage the automated tool and design a practical solution to score a super hot deal? • Explain o What’s the challenge o What’s the possible cases to handle and how? • In stock • Out of stock • Your shopping cart may be reset under what conditions… o How to add it into your shopping cart asap o How you are going to cooperate with the automated tool
  • 38. ThankThank You !!!You !!! For More Information click below link: Follow Us on: http://vibranttechnologies.co.in/selenium-classes-in-mu