SlideShare a Scribd company logo
Prepared By
Quontra Solutions
IT Courses Online Training –
USA
For Demo
Call Us : +1 404-900-9988
Email: info@quontrasolutions.com
 Introduction
 Where to get Selenium?
 Selenium Vs QTP,Silktest
 Limitations
 Features of Selenium
 Components
 Selenium CORE
 Configuring Selenium CORE
 Selenium IDE
 Selenium IDE-Sample Script
 Recording and Executing a
Script
 Selenium RC(Remote
Control)
 Starting Selenium Server
 Default Selenium Class
 Locators
 Sample Script
 Selenium Command
Reference
 Selenium RC Configuration
with Eclipse
 Object Identification
 Selenium Grid
 Selenium is set of different software tools each with a different
approach to supporting test automation.
 Selenium is an open source tool.
 Selenium supports as many as 8 programming languages such
as HTML , Ruby , PHP, Python, C#, Java, Perl etc.
 Latest side of Selenium is Grid, which allows the running of
multiple Selenium tests on different browsers and different
platforms.
 We can everything from the Selenium site
www.seleniumhq.org
Software's:
All the selenium software's can be downloaded by using the below link
http://seleniumhq.org/download/
Documentation:
Documentation can be downloaded by using the below link
http://seleniumhq.org/docs/
 Object Identification:
◦ Faster: Selenium can identify objects using xpath, So it can
directly go to a specific object
◦ Slow: Silk test and QTP follows a hierarchy for locating
objects.
 Scripting Language:
◦ QTP allow users to write script in VB script only.
◦ Silk test has proprietary scripting language 4TL. ( 4 Test
Language )
◦ But Selenium allows writing script in Java, Ruby, Perl, PHP,
C# and Python.
 Price :
◦ Selenium is an open source tool.
◦ Silk and QTP are not free tools
 QTP license cost is around $7500 , Silk test license cost is around
$8500 USD

Desktop applications:
◦ We can’t automate desktop applications using Selenium.
◦ We can automate using QTP and Silk test.
Object Repository:
Capturing objects properties is a tough task as we need to
prepare the object repository.
 It has support for multiple operating systems like Windows, Linux and
Mac
 Cross browser testing can be done easily on browsers like IE, Firefox,
Safari, Netscape etc.
 It supports multiple programming Languages like C#, Java, Ruby,
Python .. etc
 It can be used for automating Ajax and swift web pages.
 It is easy to use, if are familiar with any one of supported programming
language
 It is easy to learn
 It is free-open source tool
 It has matured community forums to get clarifications
Selenium is majorly divided into four components
 Selenium CORE
 Selenium IDE
 Selenium RC(Remote Control)
 Selenium Grid
 Selenium Core is a test tool for web applications.
 Selenium Core tests run directly in a browser.
 And they run in Internet Explorer, Mozilla Firefox on Windows, Linux, and Macintosh.
 This is deprecated with the advent of Selenium IDE and Selenium RC.
 Initially IDE has capability for recording test cases only.
 In earlier stages executed recorded script using Test runner.
 Later IDE introduced with the execution facility.
Disadvantages:
 We cannot record scripts using this.
 We can run scripts in only HTML format using Test runner.html
 Download the Selenium Core zip file (selenium-core-
1.0.1.zip) and extract the files into a folder.
 Open Command Prompt and then navigate to the
path where the files are extracted
Selenium Basics by Quontra Solutions
 A new “Selenium Functional Test Runner” window will be opened.
 We need to enter the test suite path in “Test Suite” edit box on the left hand side .
 Click on “Go” and then the screen window changes with the commands.
∗ Now click on “Run” option on the right hand side of the window
so that the test case executes successfully.
IDE means integrated development environment, which is used for record and run the scripts.
 Selenium IDE is add-on for “Mozilla Firefox”.
 The recorded scripts in Selenium IDE can be viewed in the following supported languages:
1) HTML 2) Java 3) C# 4) PERL 5) Python 6) Ruby 7) PHP
 The recorded scripts in Selenium IDE can be run against other browsers like IE, Safari,
Google, Chrome and Opera by using Selenium RC.
 By default the script that is recorded should be saved with the .html extension.
 It will keep the user actions as they are performed and store them as a reusable script to play
back.
 It supports only for Firefox.
 Using Selenium IDE we can record, save, execute and debug the scripts
 It can’t support for Database verifications Error handling and Customize reporting.
The script is saved as .html file so the run options are
active
Observations:
 Table is active here because the extension is .html
 Run Options are active and we can run the test case
now.
These are the statements
generated during record from
IDE
Observations:
 Table is not available because the format of the
script is changed to Java.
 Run options are graded out because the default
format for Selenium IDE is HTML.
Selenium Basics by Quontra Solutions
 Open Firefox and application you want to test
 Launch Selenium IDE using tools-Selenium IDE
 By default, you should be in the recording mode, but confirm it by observing the Red button.
 By default it will be in the HTML format. Otherwise, go to Options-Format-Select HTML Format.
 Record some actions and make sure that these are coming on Selenium IDE.
 During recording if you right click on any element it will show all the selenium commands
available.
 You can also edit existing command, by selecting it and editing on the boxes available.
 You can also insert/delete commands by choosing appropriate option after right clicking.
 Choose appropriate run option - i.e walk, run or test runner and review your results.
 The recorded script can be viewed in two options: 1) Table 2) Source
 In Table, we can see the script in tabular format.
 In Source, we can see the script in html code.
 If we want to see the recorded script in other selenium supported languages, Go to Options,
then
select Format select the desired language.
Drawback
 Biggest drawback of Selenium IDE is its limitation in terms of the browser support (only Mozilla
Firefox).
 Selenium RC comes in two parts i.e. Server and Client
libraries
 Selenium-RC software comes with seven folders and we need
to use these files to configure RC with the language chosen.
1) selenium-server-1.0.3 -Configuration files for launching the RC server
2) selenium-java-client-driver-1.0.1- Java supported RC files
3) selenium-perl-client-driver-1.0.1-Perl supported RC files
4) selenium-php-client-driver-1.0.1-PHP supported RC files
5) selenium-python-client-driver-1.0.1-Python supported RC files
6) selenium-ruby-client-driver-1.0.1-Ruby supported RC files
7) selenium-dotnet-client-driver-1.0.1-C# supported RC files
 Selenium RC uses a server called “Jetty Server” for launching
browsers
 Selenium RC is an Open Source platform and supports only web-
applications for automation.
 We can develop scripts using any popular programming languages
 Using Selenium RC with a high-level programming language allows
us to query database, email test results and use iteration statements
to navigate through the result set
 Using RC we can execute scripts in different browsers and platforms
Before starting any tests you must start the server.
 Go to the directory where Selenium-RC’s server is located
and run the following from a command-line console.
 Command to start server is
◦ java -jar selenium-server.jar
 Command to stop selenium server
◦ http://localhost:4444/selenium-server/driver/?cmd=shutDown
 We can do this in our test code using the SeleniumServer class
 We need to follow below steps
◦ Create an object for SeleniumServer class
◦ Use “Start” method for starting server.
◦ User “Stop” method for stopping server.
 Sample code for Starting and Stopping selenium server.
SeleniumServer server = new SeleniumServer();
server.start();
…..
server.stop();
 With the server running, we may now use a client also.
Selenium selenium = new DefaultSelenium( String seleniumServerHost,
int seleniumServerPort,
String browserType,
String baseURL);
selenium.open("http://www.somesite.com/somePage.html");
selenium.stop();
Selenium Basics by Quontra Solutions
 Default Selenium is class for creating browser reference
 Variables used in the Default Selenium constructor are:
◦ seleniumServerHost is the where the Selenium Server is running. i.e. hostname
◦ seleniumServerPort is the port on which the Selenium Server is listening. The default port is
4444.
◦ browserType is the type of browser you want to use for testing.
 Common browser types are *firefox, *iexplore, *opera and etc.
◦ baseURL is the base URL for the site you are testing.
 Now, just opening a page isn’t all that useful. We need to interact with the page. To
do this, we use our selenium client’s methods with locators. For example:
◦ selnium.click("link=Text For Some Link");
◦ The string “link=Text For Some Link” is a locator.
 In Selenium, the objects are called as locators and they can be identified using Xpath, DOM or CSS.
 Locators take the form of
◦ “locatorType=argument”
 A locator type can be an element id, an element name, an xpath expression, link text, and more.
 A few examples:
selenium.click(“id=idOfThing”); //an id locator
selenium.click(“name=nameOfThing”); //a name locator
selenium.click(“xpath=//img[@alt='The image alt text']”); //an xpath locators
slenium.click(“dom=document.images[56]” ); //a DOM locator
selenium.click(“link=Test Page For Selenium”); //a link locator
selenium.click(“css=span#firstChild”); //a css locator
Locators will be covered in detail in the next session on “Objects Construction”.
import com.thoughtworks.selenium.*; // This is a package need to be include for using Selenium API
public class SampleScript // This is Class name
{
public static void main( String args[] ) throws Exception // This is main function
{
// This is the statement for Creating Browser Object
DefaultSelenium Brw= new DefaultSelenium ("localhost",4444,"*chrome", "http://");
Brw.start(); // This statement starts the Browser
Brw.open("www.google.com"); // This statement loads google.com url
Brw.waitForPageToLoad("30000"); // This stmt waits till loading complete web page
Brw.windowMaximize(); // This stmt maximizes browser window
Brw.type("//input[@name='q']", "valuelabs"); // This stmt enters Valuelabs text in search field
Brw.click("//input[@name='btnG']"); // This stmt clicks on google search button
}
}
//input[@name='q‘] – Object Identifier for Search Field
//input[@name='btnG'] – Object locator for Search Btn
Below are usefull commands in selenium
 open - opens a page using a URL
 captureScreenshot - Captures a PNG screenshot to the specified file
 Check - Check a toggle-button (checkbox/radio)
 Click - Clicks on a link, button, checkbox or radio button
 Close – Clicks on the "close" button in the titlebar of a popup window or tab
 doubleClick - Double clicks on a link, button, checkbox or radio button
 getEval - Gets the result of evaluating the specified JavaScript code
 getHtmlSource - Returns the entire HTML source
 getLocation - Gets the absolute URL of the current page
 getText - Gets the text of an element
 getTitle - Gets the title of the current page
 getValue - Gets the value of an input field
 goBack - clicks on the "back" button on their browser
 isChecked - Gets whether a toggle-button (checkbox/radio) is checked
 isElementPresent - Verifies that the specified element is somewhere on the page
 isTextPresent - Determines if the specified element is visible
 Refresh – Clicks on the "Refresh" button on their browser
 Select - Select an option from a drop-down
 selectFrame - Selects a frame within the current window
 selectWindow - Selects a popup window
 Start - Launches the browser with a new Selenium
session
 Stop - Ends the test session, killing the browser
 Type - Sets the value of an input field
 Uncheck - Uncheck a toggle-button (checkbox/radio)
 windowMaximize - Resize currently selected window
to take up the entire screen
 Prerequisites:
 If we want to configure Selenium RC with Eclipse,
following files are required
 Eclipse
 JDK 1.5 or Later versions.
 Selenium JAR files
 a) selenium-server.jar
 b) selenium-java-client-driver.jar
 c) junit.jar
 d) Poi related jar files (For handling excel)
 Open the Eclipse by double clicking on
eclipse.exe, Click on OK for workspace
launcher. Click on
 workbench, it will allow you to move inside
the eclipse.
 Click on File->New->Select Java Project.
 Enter the Project name and then click on
“Configure JRE’s”
∗ Click on “Add” and give
the path upto the jdk
directory so that all the
JRE files will be added
and
∗ click on Finish.
∗ Now the JRE is
successfully
configured with our
project root directory
∗ Right click on JRE
System Library->
Build Path-
>Configure Build
Path
∗ Click on “Add
External JAR’s” and
then select the four
jar files and add
them to our project.
Now the jar files are also
successfully configured with our
project.
• Click on Run from the Menu-->
External Tools-->Select External
Tools Configuration--> Double
Click
on Program and then enter the
following details as shown in the
screen.
• Click on Apply and then click on
“Run”.
∗ Now the Selenium RC is
successfully configured with
Eclipse and you are ready to write
the scripts and execute them
successfully.
∗ On successful running of
Selenium server, the eclipse IDE
gives an message that the server
started successfully on port
number 4444(default)
Selenium Basics by Quontra Solutions
For identifying the properties in Selenium, we use the below
tools:
• Debug bar for Internet Explorer.
• Firebug for Mozilla Firefox.
Debug bar Installation:
• Download the debug bar software by using the below link:
http://www.debugbar.com/
• Click on the exe file and then install the software.
• Once the software is installed, you will find the debug bar on
the left side of the window.
Drag the circle
and place it on
the object
which we want
to identify the
object.
The properties will be
identified in the Attrs
field. Using these
fields, we can identify
the objects.
Firebug Installation:
 Download the debug bar software by using the
below link:
https://addons.mozilla.org/en-
US/firefox/addon/1843/
Click on the exe file and then install the software.
Once the software is installed, you will find the
firebug on the bottom of the window.
 Once we select
the object,
automatically the
objects properties
will be displayed
in the bottom:
Selenium Basics by Quontra Solutions
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.
 Selenium Grid is a tool that dramatically speeds up functional
testing of web-apps.
 It allows you to easily run multiple tests in parallel, on multiple
machines, in a heterogeneous environment.
 Selenium Grid consists of a component called “Selenium Hub”
which is the unique entry point for all the tests running by
using Selenium Grid.
To ease the maintenance of a Selenium-Grid
deployment:
 Selenium Grid Hub sends periodic heartbeat
messages to all registered Remote Controls to
make sure that they are still up and running.
 Selenium Grid Remote Controls send periodic
heartbeat messages to the Hub to check that it still
considers them as registered.
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra Solutions
Let’s have a Demo!! With
Quontra Solutions
Call Us : +1(404)-900-9988
Email:info@quontrasolutions.com
Let’s have a Demo!! With
Quontra Solutions
Call Us : +1(404)-900-9988
Email:info@quontrasolutions.com
Selenium Basics by Quontra Solutions

More Related Content

PDF
Selenium Webdriver Interview Questions
DOCX
What is selenium
PPTX
Selenium
PDF
Selenium Tutorial
PPT
Selenium
PPTX
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
PPTX
Selenium test automation
PPT
Selenium Primer
Selenium Webdriver Interview Questions
What is selenium
Selenium
Selenium Tutorial
Selenium
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
Selenium test automation
Selenium Primer

What's hot (20)

PPTX
Selenium ide made easy
PPT
Selenium Concepts
DOCX
Selenium interview Q&A
PDF
Cucumber questions
PDF
Selenium IDE features
PPT
Selenium (1)
PDF
Selenium Basics Tutorial
PPT
Selenium ppt
PPTX
Selenium IDE
PPT
Automated Web Testing Using Selenium
PPTX
Selenium Interview Questions & Answers
PDF
Selenium IDE LOCATORS
PPT
Selenium Primer
PDF
Selenium Ide Tutorial
PDF
Introduction to Selenium Automation
PPT
Selenium ide material (1)
DOCX
Selenium interview questions
PPTX
Demystifying Selenium framework
Selenium ide made easy
Selenium Concepts
Selenium interview Q&A
Cucumber questions
Selenium IDE features
Selenium (1)
Selenium Basics Tutorial
Selenium ppt
Selenium IDE
Automated Web Testing Using Selenium
Selenium Interview Questions & Answers
Selenium IDE LOCATORS
Selenium Primer
Selenium Ide Tutorial
Introduction to Selenium Automation
Selenium ide material (1)
Selenium interview questions
Demystifying Selenium framework
Ad

Viewers also liked (20)

PDF
User-Testing, Testing, 1,2,3
PDF
Practical Tips & Tricks for Selenium Test Automation - Dave Haeffner
PDF
B1015 demo on selenium testing tools
PPTX
Selenium vs QTP
PPT
Acceptance Testing With Selenium
PPT
Steps to write Selenium
PPT
Selenium
PDF
Selenium IDE
PPTX
Automated Testing using JavaScript
KEY
Testing Flex RIAs for NJ Flex user group
PPTX
Selenium and Appium Training from Sauce Labs
PDF
Automation Open Source tools
PDF
52892006 manual-testing-real-time
PDF
Web App Testing - A Practical Approach
PDF
Practical Tips & Tricks for Selenium Test Automation
PDF
Selenium WebDriver with C#
PPTX
Software testing live project training
DOCX
Selenium Testing Project report
PPTX
Testing web application
User-Testing, Testing, 1,2,3
Practical Tips & Tricks for Selenium Test Automation - Dave Haeffner
B1015 demo on selenium testing tools
Selenium vs QTP
Acceptance Testing With Selenium
Steps to write Selenium
Selenium
Selenium IDE
Automated Testing using JavaScript
Testing Flex RIAs for NJ Flex user group
Selenium and Appium Training from Sauce Labs
Automation Open Source tools
52892006 manual-testing-real-time
Web App Testing - A Practical Approach
Practical Tips & Tricks for Selenium Test Automation
Selenium WebDriver with C#
Software testing live project training
Selenium Testing Project report
Testing web application
Ad

Similar to Selenium Basics by Quontra Solutions (20)

PPT
BCS Selenium Workshop
PDF
Selenium by using JAVA
PDF
Automation Testing using Selenium Webdriver
PDF
Basics of Selenium IDE,Core, Remote Control
PPT
Selenium
PPT
Selenium
PPTX
Selenium institute in bangalore
PPTX
Introduction to selenium
PPTX
Selenium Web Driver Tutorial for Cross Browser Testing
PPT
QSpiders - Automation using Selenium
DOC
Selenium Automation Using Ruby
DOC
PPT
Selenium Introduction
PPT
Selenium
PPT
Selenium
PPT
Tanvir Afzal: Selenium
PPTX
PDF
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
PPTX
Test automation using selenium
BCS Selenium Workshop
Selenium by using JAVA
Automation Testing using Selenium Webdriver
Basics of Selenium IDE,Core, Remote Control
Selenium
Selenium
Selenium institute in bangalore
Introduction to selenium
Selenium Web Driver Tutorial for Cross Browser Testing
QSpiders - Automation using Selenium
Selenium Automation Using Ruby
Selenium Introduction
Selenium
Selenium
Tanvir Afzal: Selenium
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Test automation using selenium

More from QUONTRASOLUTIONS (20)

PPTX
Big data introduction by quontra solutions
PPTX
Java constructors
PPTX
Cognos Online Training with placement Assistance - QuontraSolutions
PDF
Business analyst overview by quontra solutions
PDF
Business analyst overview by quontra solutions
PPTX
Cognos Overview
PPTX
Hibernate online training
PPTX
Java j2eeTutorial
PPTX
Software Quality Assurance training by QuontraSolutions
PPT
Introduction to software quality assurance by QuontraSolutions
PPT
.Net introduction by Quontra Solutions
PPT
Introduction to j2 ee patterns online training class
PPTX
Saas overview by quontra solutions
PPTX
Sharepoint taxonomy introduction us
PPTX
Introduction to the sharepoint 2013 userprofile service By Quontra
PPTX
Introduction to SharePoint 2013 REST API
PPTX
Performance Testing and OBIEE by QuontraSolutions
PPTX
Obiee introduction building reports by QuontraSolutions
PPTX
Sharepoint designer workflow by quontra us
PPT
Qa by quontra us
Big data introduction by quontra solutions
Java constructors
Cognos Online Training with placement Assistance - QuontraSolutions
Business analyst overview by quontra solutions
Business analyst overview by quontra solutions
Cognos Overview
Hibernate online training
Java j2eeTutorial
Software Quality Assurance training by QuontraSolutions
Introduction to software quality assurance by QuontraSolutions
.Net introduction by Quontra Solutions
Introduction to j2 ee patterns online training class
Saas overview by quontra solutions
Sharepoint taxonomy introduction us
Introduction to the sharepoint 2013 userprofile service By Quontra
Introduction to SharePoint 2013 REST API
Performance Testing and OBIEE by QuontraSolutions
Obiee introduction building reports by QuontraSolutions
Sharepoint designer workflow by quontra us
Qa by quontra us

Recently uploaded (20)

PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Cell Structure & Organelles in detailed.
PDF
Basic Mud Logging Guide for educational purpose
PDF
Pre independence Education in Inndia.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Insiders guide to clinical Medicine.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
Cell Types and Its function , kingdom of life
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Classroom Observation Tools for Teachers
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Microbial diseases, their pathogenesis and prophylaxis
Cell Structure & Organelles in detailed.
Basic Mud Logging Guide for educational purpose
Pre independence Education in Inndia.pdf
Supply Chain Operations Speaking Notes -ICLT Program
TR - Agricultural Crops Production NC III.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Insiders guide to clinical Medicine.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Microbial disease of the cardiovascular and lymphatic systems
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPH.pptx obstetrics and gynecology in nursing
Cell Types and Its function , kingdom of life
102 student loan defaulters named and shamed – Is someone you know on the list?
Classroom Observation Tools for Teachers
3rd Neelam Sanjeevareddy Memorial Lecture.pdf

Selenium Basics by Quontra Solutions

  • 1. Prepared By Quontra Solutions IT Courses Online Training – USA For Demo Call Us : +1 404-900-9988 Email: info@quontrasolutions.com
  • 2.  Introduction  Where to get Selenium?  Selenium Vs QTP,Silktest  Limitations  Features of Selenium  Components  Selenium CORE  Configuring Selenium CORE  Selenium IDE  Selenium IDE-Sample Script  Recording and Executing a Script  Selenium RC(Remote Control)  Starting Selenium Server  Default Selenium Class  Locators  Sample Script  Selenium Command Reference  Selenium RC Configuration with Eclipse  Object Identification  Selenium Grid
  • 3.  Selenium is set of different software tools each with a different approach to supporting test automation.  Selenium is an open source tool.  Selenium supports as many as 8 programming languages such as HTML , Ruby , PHP, Python, C#, Java, Perl etc.  Latest side of Selenium is Grid, which allows the running of multiple Selenium tests on different browsers and different platforms.
  • 4.  We can everything from the Selenium site www.seleniumhq.org Software's: All the selenium software's can be downloaded by using the below link http://seleniumhq.org/download/ Documentation: Documentation can be downloaded by using the below link http://seleniumhq.org/docs/
  • 5.  Object Identification: ◦ Faster: Selenium can identify objects using xpath, So it can directly go to a specific object ◦ Slow: Silk test and QTP follows a hierarchy for locating objects.  Scripting Language: ◦ QTP allow users to write script in VB script only. ◦ Silk test has proprietary scripting language 4TL. ( 4 Test Language ) ◦ But Selenium allows writing script in Java, Ruby, Perl, PHP, C# and Python.  Price : ◦ Selenium is an open source tool. ◦ Silk and QTP are not free tools  QTP license cost is around $7500 , Silk test license cost is around $8500 USD
  • 6.  Desktop applications: ◦ We can’t automate desktop applications using Selenium. ◦ We can automate using QTP and Silk test. Object Repository: Capturing objects properties is a tough task as we need to prepare the object repository.
  • 7.  It has support for multiple operating systems like Windows, Linux and Mac  Cross browser testing can be done easily on browsers like IE, Firefox, Safari, Netscape etc.  It supports multiple programming Languages like C#, Java, Ruby, Python .. etc  It can be used for automating Ajax and swift web pages.  It is easy to use, if are familiar with any one of supported programming language  It is easy to learn  It is free-open source tool  It has matured community forums to get clarifications
  • 8. Selenium is majorly divided into four components  Selenium CORE  Selenium IDE  Selenium RC(Remote Control)  Selenium Grid
  • 9.  Selenium Core is a test tool for web applications.  Selenium Core tests run directly in a browser.  And they run in Internet Explorer, Mozilla Firefox on Windows, Linux, and Macintosh.  This is deprecated with the advent of Selenium IDE and Selenium RC.  Initially IDE has capability for recording test cases only.  In earlier stages executed recorded script using Test runner.  Later IDE introduced with the execution facility. Disadvantages:  We cannot record scripts using this.  We can run scripts in only HTML format using Test runner.html
  • 10.  Download the Selenium Core zip file (selenium-core- 1.0.1.zip) and extract the files into a folder.  Open Command Prompt and then navigate to the path where the files are extracted
  • 12.  A new “Selenium Functional Test Runner” window will be opened.  We need to enter the test suite path in “Test Suite” edit box on the left hand side .  Click on “Go” and then the screen window changes with the commands.
  • 13. ∗ Now click on “Run” option on the right hand side of the window so that the test case executes successfully.
  • 14. IDE means integrated development environment, which is used for record and run the scripts.  Selenium IDE is add-on for “Mozilla Firefox”.  The recorded scripts in Selenium IDE can be viewed in the following supported languages: 1) HTML 2) Java 3) C# 4) PERL 5) Python 6) Ruby 7) PHP  The recorded scripts in Selenium IDE can be run against other browsers like IE, Safari, Google, Chrome and Opera by using Selenium RC.  By default the script that is recorded should be saved with the .html extension.  It will keep the user actions as they are performed and store them as a reusable script to play back.  It supports only for Firefox.  Using Selenium IDE we can record, save, execute and debug the scripts  It can’t support for Database verifications Error handling and Customize reporting.
  • 15. The script is saved as .html file so the run options are active Observations:  Table is active here because the extension is .html  Run Options are active and we can run the test case now.
  • 16. These are the statements generated during record from IDE
  • 17. Observations:  Table is not available because the format of the script is changed to Java.  Run options are graded out because the default format for Selenium IDE is HTML.
  • 19.  Open Firefox and application you want to test  Launch Selenium IDE using tools-Selenium IDE  By default, you should be in the recording mode, but confirm it by observing the Red button.  By default it will be in the HTML format. Otherwise, go to Options-Format-Select HTML Format.  Record some actions and make sure that these are coming on Selenium IDE.  During recording if you right click on any element it will show all the selenium commands available.  You can also edit existing command, by selecting it and editing on the boxes available.  You can also insert/delete commands by choosing appropriate option after right clicking.  Choose appropriate run option - i.e walk, run or test runner and review your results.  The recorded script can be viewed in two options: 1) Table 2) Source  In Table, we can see the script in tabular format.  In Source, we can see the script in html code.  If we want to see the recorded script in other selenium supported languages, Go to Options, then select Format select the desired language. Drawback  Biggest drawback of Selenium IDE is its limitation in terms of the browser support (only Mozilla Firefox).
  • 20.  Selenium RC comes in two parts i.e. Server and Client libraries  Selenium-RC software comes with seven folders and we need to use these files to configure RC with the language chosen. 1) selenium-server-1.0.3 -Configuration files for launching the RC server 2) selenium-java-client-driver-1.0.1- Java supported RC files 3) selenium-perl-client-driver-1.0.1-Perl supported RC files 4) selenium-php-client-driver-1.0.1-PHP supported RC files 5) selenium-python-client-driver-1.0.1-Python supported RC files 6) selenium-ruby-client-driver-1.0.1-Ruby supported RC files 7) selenium-dotnet-client-driver-1.0.1-C# supported RC files  Selenium RC uses a server called “Jetty Server” for launching browsers
  • 21.  Selenium RC is an Open Source platform and supports only web- applications for automation.  We can develop scripts using any popular programming languages  Using Selenium RC with a high-level programming language allows us to query database, email test results and use iteration statements to navigate through the result set  Using RC we can execute scripts in different browsers and platforms
  • 22. Before starting any tests you must start the server.  Go to the directory where Selenium-RC’s server is located and run the following from a command-line console.  Command to start server is ◦ java -jar selenium-server.jar  Command to stop selenium server ◦ http://localhost:4444/selenium-server/driver/?cmd=shutDown
  • 23.  We can do this in our test code using the SeleniumServer class  We need to follow below steps ◦ Create an object for SeleniumServer class ◦ Use “Start” method for starting server. ◦ User “Stop” method for stopping server.  Sample code for Starting and Stopping selenium server. SeleniumServer server = new SeleniumServer(); server.start(); ….. server.stop();  With the server running, we may now use a client also. Selenium selenium = new DefaultSelenium( String seleniumServerHost, int seleniumServerPort, String browserType, String baseURL); selenium.open("http://www.somesite.com/somePage.html"); selenium.stop();
  • 25.  Default Selenium is class for creating browser reference  Variables used in the Default Selenium constructor are: ◦ seleniumServerHost is the where the Selenium Server is running. i.e. hostname ◦ seleniumServerPort is the port on which the Selenium Server is listening. The default port is 4444. ◦ browserType is the type of browser you want to use for testing.  Common browser types are *firefox, *iexplore, *opera and etc. ◦ baseURL is the base URL for the site you are testing.  Now, just opening a page isn’t all that useful. We need to interact with the page. To do this, we use our selenium client’s methods with locators. For example: ◦ selnium.click("link=Text For Some Link"); ◦ The string “link=Text For Some Link” is a locator.
  • 26.  In Selenium, the objects are called as locators and they can be identified using Xpath, DOM or CSS.  Locators take the form of ◦ “locatorType=argument”  A locator type can be an element id, an element name, an xpath expression, link text, and more.  A few examples: selenium.click(“id=idOfThing”); //an id locator selenium.click(“name=nameOfThing”); //a name locator selenium.click(“xpath=//img[@alt='The image alt text']”); //an xpath locators slenium.click(“dom=document.images[56]” ); //a DOM locator selenium.click(“link=Test Page For Selenium”); //a link locator selenium.click(“css=span#firstChild”); //a css locator Locators will be covered in detail in the next session on “Objects Construction”.
  • 27. import com.thoughtworks.selenium.*; // This is a package need to be include for using Selenium API public class SampleScript // This is Class name { public static void main( String args[] ) throws Exception // This is main function { // This is the statement for Creating Browser Object DefaultSelenium Brw= new DefaultSelenium ("localhost",4444,"*chrome", "http://"); Brw.start(); // This statement starts the Browser Brw.open("www.google.com"); // This statement loads google.com url Brw.waitForPageToLoad("30000"); // This stmt waits till loading complete web page Brw.windowMaximize(); // This stmt maximizes browser window Brw.type("//input[@name='q']", "valuelabs"); // This stmt enters Valuelabs text in search field Brw.click("//input[@name='btnG']"); // This stmt clicks on google search button } } //input[@name='q‘] – Object Identifier for Search Field //input[@name='btnG'] – Object locator for Search Btn
  • 28. Below are usefull commands in selenium  open - opens a page using a URL  captureScreenshot - Captures a PNG screenshot to the specified file  Check - Check a toggle-button (checkbox/radio)  Click - Clicks on a link, button, checkbox or radio button  Close – Clicks on the "close" button in the titlebar of a popup window or tab  doubleClick - Double clicks on a link, button, checkbox or radio button  getEval - Gets the result of evaluating the specified JavaScript code  getHtmlSource - Returns the entire HTML source  getLocation - Gets the absolute URL of the current page  getText - Gets the text of an element  getTitle - Gets the title of the current page  getValue - Gets the value of an input field  goBack - clicks on the "back" button on their browser  isChecked - Gets whether a toggle-button (checkbox/radio) is checked  isElementPresent - Verifies that the specified element is somewhere on the page  isTextPresent - Determines if the specified element is visible  Refresh – Clicks on the "Refresh" button on their browser
  • 29.  Select - Select an option from a drop-down  selectFrame - Selects a frame within the current window  selectWindow - Selects a popup window  Start - Launches the browser with a new Selenium session  Stop - Ends the test session, killing the browser  Type - Sets the value of an input field  Uncheck - Uncheck a toggle-button (checkbox/radio)  windowMaximize - Resize currently selected window to take up the entire screen
  • 30.  Prerequisites:  If we want to configure Selenium RC with Eclipse, following files are required  Eclipse  JDK 1.5 or Later versions.  Selenium JAR files  a) selenium-server.jar  b) selenium-java-client-driver.jar  c) junit.jar  d) Poi related jar files (For handling excel)
  • 31.  Open the Eclipse by double clicking on eclipse.exe, Click on OK for workspace launcher. Click on  workbench, it will allow you to move inside the eclipse.  Click on File->New->Select Java Project.  Enter the Project name and then click on “Configure JRE’s”
  • 32. ∗ Click on “Add” and give the path upto the jdk directory so that all the JRE files will be added and ∗ click on Finish.
  • 33. ∗ Now the JRE is successfully configured with our project root directory ∗ Right click on JRE System Library-> Build Path- >Configure Build Path
  • 34. ∗ Click on “Add External JAR’s” and then select the four jar files and add them to our project.
  • 35. Now the jar files are also successfully configured with our project. • Click on Run from the Menu--> External Tools-->Select External Tools Configuration--> Double Click on Program and then enter the following details as shown in the screen. • Click on Apply and then click on “Run”.
  • 36. ∗ Now the Selenium RC is successfully configured with Eclipse and you are ready to write the scripts and execute them successfully. ∗ On successful running of Selenium server, the eclipse IDE gives an message that the server started successfully on port number 4444(default)
  • 38. For identifying the properties in Selenium, we use the below tools: • Debug bar for Internet Explorer. • Firebug for Mozilla Firefox. Debug bar Installation: • Download the debug bar software by using the below link: http://www.debugbar.com/ • Click on the exe file and then install the software. • Once the software is installed, you will find the debug bar on the left side of the window.
  • 39. Drag the circle and place it on the object which we want to identify the object.
  • 40. The properties will be identified in the Attrs field. Using these fields, we can identify the objects.
  • 41. Firebug Installation:  Download the debug bar software by using the below link: https://addons.mozilla.org/en- US/firefox/addon/1843/ Click on the exe file and then install the software. Once the software is installed, you will find the firebug on the bottom of the window.
  • 42.  Once we select the object, automatically the objects properties will be displayed in the bottom:
  • 44. 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.  Selenium Grid is a tool that dramatically speeds up functional testing of web-apps.  It allows you to easily run multiple tests in parallel, on multiple machines, in a heterogeneous environment.  Selenium Grid consists of a component called “Selenium Hub” which is the unique entry point for all the tests running by using Selenium Grid.
  • 45. To ease the maintenance of a Selenium-Grid deployment:  Selenium Grid Hub sends periodic heartbeat messages to all registered Remote Controls to make sure that they are still up and running.  Selenium Grid Remote Controls send periodic heartbeat messages to the Hub to check that it still considers them as registered.
  • 48. Let’s have a Demo!! With Quontra Solutions Call Us : +1(404)-900-9988 Email:info@quontrasolutions.com Let’s have a Demo!! With Quontra Solutions Call Us : +1(404)-900-9988 Email:info@quontrasolutions.com