+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Selenium Training
1. WEB APPLICATIONS TEST AUTOMATION
USING SELENIUM
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 1
2. AGENDA
Selenium IDE
Test Cases and Test Suites
Selenium Commands
Regular Expression
Ajax Applications
User Extensions and Flow Controls
Cross Browser Testing
Location Strategies
Alerts, Popups and Multiple Windows
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 2
3. SELENIUM IDE
Installation
Selenium IDE Features
Understand Timeout
Limitations of Selenium IDE
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 3
6. FREQUENTLY USED COMMANDS
open
click / clickAndWait
verifyTitle / assertTitle
verifyTextPresent
verifyElementPresent
verifyText
verifyTable
waitForPageToLoad
waitForElementPresent
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 6
7. SELENIUM IDE : LOG PANE
Useful for Debugging
Automatically Selected When Tests are Executed
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 7
8. SELENIUM IDE : REFERENCE PANE
Display Reference of Current Command
Default Pane
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 8
9. SELENIUM IDE : MENU BAR
Speed Control
Run All Tests
Run Currently Selected Test
Pause/Resume
Step
Apply Roll-up Rules
Recording
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 9
10. SELENIUM IDE : TEST CASE PANE
Use for Editing Commands
Read Reference Documentation Before Giving
Parameters (e.g. Store Command)
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 10
11. SELENIUM IDE : TEST CASE PANE
Context Menu
Stop in the Middle
Start from the Middle
Run Single Command
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 11
12. TEST CASES AND TEST SUITES
Create Test Cases
Create Test Suites
Naming Conventions
Test Project Packaging and Best Practices
Modifying Test Cases and Test Suites
User of Variables in Test Cases
Creating and Using Random Variables
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 12
13. EDITING
Adding New Commands
Inset Comments
Editing Test Cases
Editing Test Suites
Table View, Source View
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 13
15. VERIFY PAGE ELEMENTS
Element Present Somewhere in the Page
Specific Text Present in Somewhere in the Page
Specific Text Present at Specific Location
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 15
16. ASSERT OR VERIFY?
When to use assert commands
When to use verify commands
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 16
17. FEW USEFUL STORE COMMANDS
store
storeElementPresent
storeHtmlSource
storeEditable
storeTitle
storeSelectedLabel
storeTable
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 17
18. STORE COMMAND : EXAMPLE
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 18
19. USE OF VARIABLES IN JAVASCRIPTS
storeEval command
storedVars['counter']=parseInt(storedVars['counter'])+1
Javascript{ ${variableName} + ‘Some Text’ }
Case Sensitivity
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 19
20. MATCHING TEXT PATTERNS
Globbing Patterns
Regular Expression Patterns
Exact Pattern
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 20
22. REGULAR EXPRESSION
<tr>
<td>verifyTitle</td>
<td>regexp:.*Simplicity into Software Testing</td>
<td></td>
</tr>
<tr>
<td>verifyTitle</td>
<td>regexpi:.*simplicity into software testing</td>
<td></td>
</tr>
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 22
23. LOGS
Setting Log Levels
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 23
24. SELENIUM COMMANDS
Selense
Actions
Assessors
Assertions
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 24
25. ACTIONS
Commands that Manipulate the State
Click this link, Select that Option
Test Stops if Actions Fail or has an Error
Commands with ‘AndWait’ Suffix
Hands-on
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 25
26. ACCESSORS
Examine State and Store the Value in Variable
Store Commands
Test Stops if an Accessor has an Error
Hands-on
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 26
27. ASSERTIONS
Like Accessors
Verify and Confirm the State
Asserts, Verify and WaitFor
When Assert Fails Test is Aborted
When Verify Fails Test Continue, Failure is Logged
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 27
28. TESTING AJAX
Understanding Ajax
WaitFor Commands
Hands-on
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 28
29. LOCATION STRATEGIES
Locating Elements in a Web Application
Format LocatorType=Location
Supported Strategies
We Can Define Our Own Strategies
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 29
30. LOCATION STRATEGIES : IDENTIFIER
Default Strategy
identifier=id
Select the element with the specified @id attribute
If no match is found,
select the first element whose @name attribute is
id
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 30
31. LOCATION STRATEGIES : ID
id=id
Select the element with the specified @id attribute
Hands-on
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 31
32. LOCATION STRATEGIES : NAME
name=name
Select the first element with the specified @name attribute
Optionally be Followed by One or More Element-filters
Default Filter is Value
name=company value=Allion
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 32
33. LOCATION STRATEGIES : DOM
dom=javascriptExpression
Find an element by evaluating the specified string
Traverse HTML Document Object Model using JavaScript
dom=document.forms['myForm'].myDropdown
dom=document.images[56]
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 33
34. LOCATION STRATEGIES : XPATH
xpath=xpathExpression
Locate an element using an XPath expression.
xpath=//img[@alt='The image alt text']
xpath=//a[contains(@href,'#id1')]
xpath=//input[@name='name2' and @value='yes']
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 34
35. LOCATION STRATEGIES : LINK
link=textPattern
Select the link (anchor) element which contains text
matching the specified pattern
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 35
36. LOCATION STRATEGIES : CSS
css=cssSelectorSyntax
Select the element using css selectors
css=input[name="username"]
css=input.required[type="text"]
css=#loginForm input:nth-child(2)
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 36
37. USER EXTENSIONS
Helps to Add Additional Functionality
Install a User Extension
Flow Controls
Selenium and PageBot Object Prototype
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 37
38. USER EXTENSIONS
Writing Your Own Action
Wiring Your Own Assertion
Writing Your Own Location Strategy
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 38
39. CROSS BROWSER TESTING
Installing RC
Starting RC Server
Running Tests
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 39
41. ALERTS
assertAlert(Pattern) : Throws error if pattern does not match
assertAlertPresent : Useful when we don’t know the message
assertAlertNotPresent : Throws error if alert is present
storeAlert(variable) : Stores the message to a variable
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 41
48. SELENIUM PLUGINS
File Logging
Highlight Elements
Log Search Bar
Page Coverage
Power Debugger
Screenshot on Fail
Selenium Expert
Stored Variables Viewer
Test Results
Test Suite Batch Converter
JANESH KODIKARA- PRAGMATIC TEST LABS 11 November 2012 48