Amit - Automation Using Selenium
Amit - Automation Using Selenium
Agenda
9What is Selenium ?
Selenium Components
Advantages of Selenium
Selenese-The language of Selenium
Source Repository
Selenium User Forums
Selenium Developer Forums
Selenium-How to Contribute
What is Selenium ?
Selenium
Selenium Components
1. Selenium Core
Core engine of Selenium
JavaScript/DHTML library
Other Selenium components such as IDE and RC
build on it
Supports a variety of platforms
Selenium Components
2. Selenium IDE
Integrated development
environment for Selenium tests
Enables you to record a browser
session
Implemented as a Mozilla FireFox
extension
Allows you to record, edit, and
debug tests.
Selenium Components..
Advantages of Selenium
Open source, free software
Easy Installation
Scripting Techniques :
Easy recording and playback of scripts
Modular scripts
Compatibility :
Multiple operating systems (Windows, Linux, Mac)
Actions - Commands
Data related
Take only element locators
Examples :
1. store(locator,variable)
2. verify(locator,pattern)
3.eval- return value of JS expression
4. bodyText-contents of HTML body
Element Locators
Sample Script
require "selenium"
require "test/unit"
def test_new
@selenium.open "/"
@selenium.type "q", "Hello"
@selenium.click "btnG"
@selenium.wait_for_page_to_load "30000"
begin
assert @selenium.is_text_present("Hello is a new way to look at
pictures with friends and family. )
rescue Test::Unit::AssertionFailedError
@verification_errors << $!
end
temp = @selenium.get_text("//div[2]/div[1]")
end
end
Configuration :
Set path variables
Use multiWindow option while starting server
Resource :
Users should have basic scripting knowledge
Hardware No specific requirement the basic configuration for a server
P4, 512 MB RAM is good enough.
Potential Causes :
Can happen due to execution speed of Selenium
Elements do not load on page in time
Fix :
Add code in scripts which waits for elements
Additional issues :
Sometimes existing elements on a page are not detected
Sometimes elements on a page have a same label
Solution :
Obtain exact element label from source code
Label can be used in scripts for accuracy
Handling of Frames
Option :
-multiWindow option handles potential frame problems
Causes :
At times required name of frame not obtained in recording
Fix :
Obtain frame label from source code
Also can be obtained from browser URL bar
Benefits to Organization
Benefits to Organization
Automation Benefits :
Usual benefits for automation e.g. Time saving
Time required for sanity reduced ( 12 man hours to 3 man hours, build
frequency of 4-5 builds a month )
For one of the projects, Sanity suite automated : 243 test cases
Caveat:
Full automation and maintenance has not been evaluated and that can be
a risk
Drawbacks
Lack of exhaustive formal guidance material
Mozilla FireFox browser is required for script
recording
Only works with web based applications
Selenium Core
http://forums.openqa.org/forum.jspa?forumID=3
Selenium IDE
http://forums.openqa.org/forum.jspa?forumID=2
Selenium RC
http://forums.openqa.org/forum.jspa?forumID=13
Developer Forums
http://forums.openqa.org/forum.jspa?forumID=4
Post suggestions, feature requests, patches, etc..
Development mailing list : selenium-core-devsubscribe@openqa.org
Send emails in plain text format only
QA/User Contribution :
Submit bug reports , with patches
Helping out in forums
Development :
Becoming a regular Selenium developer is on invite-only
basis
Questions