Web Browser Automation
With Selenium IDE
By Andrew Weidner
University of North Texas Libraries
Digital Projects Unit Tech Talk
March 28, 2012
1 Selenium IDE Basics
2 Digital Projects: Use Cases
3 Resources
4 Demonstration
Selenium IDE Basics
OR
What It Is and How It Works
"Any tool should be useful in the expected
way, but a truly great tool lends itself to
uses you never expected."
Eric Steven Raymond
The Cathedral And The Bazaar
Firefox Plugin
designed for debugging Web applications
automates complex clickstreams
Any Operating System
running Firefox 3 or later
Current Version: 1.7.2
Selenium GUI
Selenium GUI
Integrated
Development
Environment
Selenium GUI
Integrated
Development
Environment
● create
● debug
● run
Selenium GUI
Integrated
Development
Environment
● create
● debug
● run
HTML Scripts
aka
Test Cases
Controls
Speed Slider
Record
Button
Play Buttons
Selenium Window Elements
Selenium Window Elements
Script File Name
Selenium Window Elements
Script File Name
Command Table
Selenium Window Elements
Script File Name
Command Table
Command Editor
Selenium Window Elements
Script File Name
Command Table
Command Editor
Information
Tabs
Selenium Edit Interface
Command Table
Command Editor
Selenium Edit Interface
Table View
Selenium Edit Interface
Script Components
Selenium Edit Interface
Script Components
1. Commands
Selenium Edit Interface
Script Components
1. Commands
Selenium Edit Interface
Script Components
1. Commands
(Browser Actions)
Selenium Edit Interface
Script Components
1. Commands
(Browser Actions)
2. Targets
Selenium Edit Interface
Script Components
1. Commands
(Browser Actions)
2. Targets
Selenium Edit Interface
Script Components
1. Commands
(Browser Actions)
2. Targets
(Page Objects)
Selenium Edit Interface
Script Components
1. Commands
(Browser Actions)
2. Targets
(Page Objects)
3. Values
Selenium Edit Interface
Script Components
1. Commands
(Browser Actions)
2. Targets
(Page Objects)
3. Values
Selenium Edit Interface
Script Components
1. Commands
(Browser Actions)
2. Targets
(Page Objects)
3. Values
(Menus, Text)
Selenium Edit Interface
Source View
Script Components
1. Commands
(Browser Actions)
2. Targets
(Page Objects)
3. Values
(Menus, Text)
Source View
Script Components
1. Commands
(Browser Actions)
2. Targets
(Page Objects)
3. Values
(Menus, Text)
HTML Table
Script Components
1. Commands
(Browser Actions)
2. Targets
(Page Objects)
3. Values
(Menus, Text)
HTML Table
Script Components
1. Commands
(Browser Actions)
2. Targets
(Page Objects)
3. Values
(Menus, Text)
HTML Table
Script Components
1. Commands
(Browser Actions)
2. Targets
(Page Objects)
3. Values
(Menus, Text)
HTML Table
Script Components
1. Commands
(Browser Actions)
2. Targets
(Page Objects)
3. Values
(Menus, Text)
Command Syntax
| Command | Target | Value |
Command Syntax
| Command | Target | Value |
Wikipedia Search Script
Command Syntax
| Command | Target | Value |
Wikipedia Search Script
| open | http://www.wikipedia.org | |
Command Syntax
| Command | Target | Value |
Wikipedia Search Script
| open | http://www.wikipedia.org | |
| type | //div[@id='p-search']/form/fieldset/input | |
Command Syntax
| Command | Target | Value |
Wikipedia Search Script
| open | http://www.wikipedia.org | |
| type | //div[@id='p-search']/form/fieldset/input | T |
Command Syntax
| Command | Target | Value |
Wikipedia Search Script
| open | http://www.wikipedia.org | |
| type | //div[@id='p-search']/form/fieldset/input | Te |
Command Syntax
| Command | Target | Value |
Wikipedia Search Script
| open | http://www.wikipedia.org | |
| type | //div[@id='p-search']/form/fieldset/input | Tex |
Command Syntax
| Command | Target | Value |
Wikipedia Search Script
| open | http://www.wikipedia.org | |
| type | //div[@id='p-search']/form/fieldset/input | Texa |
Command Syntax
| Command | Target | Value |
Wikipedia Search Script
| open | http://www.wikipedia.org | |
| type | //div[@id='p-search']/form/fieldset/input | Texas |
Command Syntax
| Command | Target | Value |
Wikipedia Search Script
| open | http://www.wikipedia.org | |
| type | //div[@id='p-search']/form/fieldset/input | Texas |
| clickAndWait | name=go | |
Command Syntax
| Command | Target | Value |
Wikipedia Search Script
Selenium GUI
Questions ?
Digital Projects: Use Cases
OR
Automated Metadata Editing
"If you have the right attitude,
interesting problems will find you."
Eric Steven Raymond
The Cathedral And The Bazaar
Types of Tasks
1 Interface Focus
2 Administrative Automation
3 Full Automation
Interface Focus
Dashboard Housekeeping
less visual clutter = easier to focus
Interface Focus
Interface Focus
Interface Focus
| click | link=Collapse All Fields | |
| click | id=item-title | |
| click | id=item-date | |
| click | id=item-description | |
| click | id=item-coverage | |
| click | id=item-note | |
Administrative
Automation
Dashboard Databot
less repetitive data entry = improved concentration
Administrative
Automation
Base Realignment And Closure (BRAC) Commission
10,000+ Objects
Incorrect Titles & Dates
Sub-standard Descriptions
Add Value with Subjects & Coverage
Administrative
Automation
Administrative
Automation
Administrative
Automation
| click | css=image[alt=”add”] | |
| select | //div[@id='main']/div/div[4]/div/select | Added Title |
| storeValue | //div[@id='main']/div/div[2]/div/input | BRACtitle |
| type | //div[@id='main']/div/div[4]/div/input | ${BRACtitle} |
| type | //div[@id='main']/div/div[2]/div/input | [Memorandum of Meeting: ] |
| setCursorPosition | //div[@id='main']/div/div[2]/div/input | 24 |
Full
Automation
Dashboard Cruise Control
automated editing = improved accuracy
automated editing = more time for ________
Full
Automation
Congressional Research Service (CRS) Reports
10,000+ Objects
>5,000 did not have Creation Dates
Creation Date was present in the Identifier
Full
Automation
Full
Automation
Full
Automation
Full
Automation
Test
Suite
The last two commands Publish the record & Close the tab.
The next script in the suite runs on the next tab until there
are either no more scripts or no more tabs.
Full
Automation
Quality Control Commands
assertValue: tests the value of menu / text input
(supports regular expressions for text)
assertElementPresent: tests for presence of object
assertElementNotPresent: tests for non-presence of object
Resources
OR
Selenium for Fun and Profit
DPU Wiki
Other HowTos > Install and Use Selenium
Selenium Documentation
http://seleniumhq.org/docs/02_selenium_ide.html
Google Groups
Selenium Users & Selenium Developers
Selenium in the Cloud
http://saucelabs.com/
Useful Firefox Plugins
Firebug: dynamically view page source for debugging
Power Debugger: adds a “Pause On Fail” button
Highlight Elements: highlights elements during test runs
Favorites: opens and executes favorite scripts & suites
Linky: opens multiple links for batch processing
Further Inquiry
Selenium WebDriver/Server/Grid: set of tools for running
tests across multiple machines & operating systems.
Supports other browsers & programming languages.
Questions ?
Demonstration
UNT Libraries Toolkit
Portal To Texas History Slideshow