Вы находитесь на странице: 1из 24

Selenium Tool

Presented by : Sayali Nagarkar


Bhumika Sadbhave
Ganesh Chaudhari
Abhishek Sakalkar
Containts
 What is Selenium ?
• Selenium Components
• Advantages of Selenium
• Selenese-The language of SeleniumA
 Automating Tests using Selenium
• Prerequisites and Test Bed Setup
• Scripting Techniques and Best Practices
 Known Issues
 Benefits to Organization
 Drawbacks
 Selenium-How to Contribute
Selenium

 Selenium is a open source Functional Automation tool for


Web applications.
 Selenium supports the languages like HTML, Java, PHP,
Perl, Python, Ruby and C#.
 It supports the browsers like IE, Mozilla Firefox, Safari,
Google Chrome and Opera.
 It supports the operating systems like Windows, Linux and
Mac.
 It is very flexible when compared to QTP and other
functional tools, because it supports multiple languages.
Selenium Components
1. Selenium IDE
 IDE stands for Integrated Development
Environment.

 Which is used for Record and Play back the scripts.

 It is an Add on for Mozilla Firefox, which means we


can download the Selenium IDE from Mozilla Firefox
( Mozilla Firefox only).

 Selenium IDE is accountable for user actions.

 We can Run the Recorded scripts against other


browsers by using Selenium RC.
2. Selenium Remote Control (RC)

 RC stands for Remote Control.(Selenium 1)

 It is a Server and launches the Browser.

 It acts as a API and Library of Selenium.

 We need to configure the Selenium RC with the


supported language, then we can automate the
application.
Selenium Grid
 Selenium Grid is used for launching the multiple
browsers with supported operating system in
parallel.
 We can run the scripts on different browsers in
parallel.
 It allows you to easily run multiple tests in
parallel, on multiple machines, in a
heterogeneous environment.
Advantages of Selenium
 Open source, free software
 Easy Installation
 Easy recording and playback of scripts
 Compatibility :
 Multiple operating systems (Windows, Linux, Mac)
 Allows cross browser testing (Record in FireFox,
execute in IE)
 No dedicated machine required for test
execution (user can work in parallel).
 Integration with third party tools.
Selenese-The language of Selenium

Selenese consists of Actions, Accessors, Element Locators and Variables

• Actions - Commands for the selenese language to perform a action


on a web application

 Script performs a particular action


 Typically take element locator and possibly a value
 Examples :
1.Open- open a url
2.Click- click button, link, etc..
3.Type- type text in text field
Selenese-The language of Selenium
• Accessors – Verification / Validation checkpoints for the tool

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
Selenese-The language of Selenium

• Element Locators

 These can be id, name, identifier, link, etc..

 Variables used in scripting

 Information regarding Actions, Accessors can be


found in class ‘Selenium Driver’ in installed directory
For e.g. C:\Selenium\selenium-remote-control-
0.9.0\ruby\doc\index.html
Automating Tests using Selenium
Prerequisites and Test Bed Setup
 Software :
Selenium IDE, Mozilla FireFox for script recording
Selenium Server, Java for running scripts
 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 – 512 MB RAM is good
enough.
Scripting Techniques and Best Practices

In order to ensure the quality of scripts and reduce maintenance,


it is best to have scripting techniques and best practices. Some of
which are…

 Comments and proper formatting in scripts


 Scripting considerations for integration with other tools
 Documentation of basic data required for scripts
 Documentation of new functions added for scripts
 Follow fixed, logical scripting format
 Include code to handle Selenium errors
 Scripting according to application specific issues
Selenium: Known Issues
Pop-up Windows

 Simple, prompt, or confirmation alert pops-up , it can


be difficult to automate it to either accept or close.
 Windows-based alerts : beyond Selenium’s
capabilities (they’re part of the OS not the browser)
 Handling web-based alerts : switchTo method ->
control the pop-up while keeping the browser in the
background.
Dynamic Content

 A web page having dynamically loaded content ->


elements that may not be at first visible when you visit the
site.
This can mean that
 the page is user specific and will display different content
based on different users
 new content appears on the page after a certain
amount of time
 or it appears after clicking something on the page.
 Solution: Integrated Explicit Wait: specify an amount of
time to wait before automating a command.
 Page gets enough time to load and identify the element.
Flakiness

 Sometimes Selenium will give you flaky tests: they’ll


come back as positive or negative; when they
actually are the opposite.
 Factors: unstable build, poor test isolation, flaky
external services, and timeouts.
 Why your builds are unstable?
 Examine elements of your Selenium tests
 Approach the problem head-on.
Mobile Testing
 Selenium can test on any operating system and browser.
 Cannot run on mobile operating systems like iOS and
Android.
 The Selenium family has a solution.
 Appium, is an open source test automation framework :
testing mobile apps instead of web applications.
 Developers and testers are taking advantage of the
functionalities of Appium.
Multi-tab Testing
 Selenium -> ability to test in multiple tabs, if you know the
correct commands.
 Example, if you want to open a new tab to perform a
specific action without leaving the original tab, you’ll still
want to be able to control both tabs and go back to the
parent tab if users are likely to perform these kinds of
actions.
 The best method : store the previous window handle in a
variable
 Then continue in the new window and store that in a
second variable.
 Then, you can use the switchTo method to go between
both windows as needed.
References:
https://www.seleniumhq.org/
https://wikipedeia.org/

Thank You !!!


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
 Good Returns on Zero Investment
 Increasing Productivity

 Cost saving as it is open-source


 QA engineers get familiar with scripting languages like Ruby,
Perl etc apart from
 manual testing
 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 –How to Contribute

QA/User Contribution :
 Submit bug reports , with patches
 Helping out in forums

Development :
 Becoming a regular Selenium developer is on invite-
only basis

Вам также может понравиться