Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

1.

what is Selenium

It is an open source (free) automated testing suite to test web applications

Selenium is mainly used for Functional and regression Testing (Test Automation)

Selenium is open source software to automate Web Browsers

Selenium supports various operating systems

MS windows

Macintosh etc.,

Linux

Selenium supports various Browsers to create and execute Tests/Test Cases/ Test Scripts

Mozilla Firefox , Google Chrome , Internet Explorer / MS edge ,Opera and Safari ect..

Selenium supports varies Programming languages write programs (Test Scripts)

Java , Python , C# .net , Perl , Ruby and PHP

NOTE: Selenium Does not support any Programming Language

#########################################################

2.History of the Selenium Project

Selenium was launched in 2004,

In 2006 WebDriver was launched at Google.

In 2008 the whole selenium Team decided to merge with Selenium WebDriver with Selenium RC in
Orders to form powerful tool Called selenium 2.0

Selenium 1.0

(Selenium IDE + Selenium RC + Selenium Grid)

Selenium 1.0 + Selenium WebDriver = Selenium 2.0

Selenium2.0

(Selenium IDE + selenium RC + Selenium Grid + Selenium WebDriver)

Selenium 3.0 ( In Oct 2016 )

(Selenium IDE + Selenium Grid + Selenium WebDriver)

In Selenium 2.0 default browser is Mozilla Firefox , But in 3.0 No default Browser
###############################################################

3.Selenium Components/Selenium Tools

Selenium IDE (Died)/ No support: Selenium


IDE (Integrated Development
Environment) is a Firefox plugin. It is the simplest framework in the Selenium
Suite. It allows us to record and playback the scripts. Even though we can
create scripts using Selenium IDE, we need to use Selenium RC or Selenium
WebDriver to write more advanced and robust test cases.
Selenium RC (Outdated)

Selenium WebDriver: Active

Selenium WebDriver AKA Selenium 2 is a browser automation framework that


accepts commands and sends them to a browser. It is implemented through a
browser-specific driver. It controls the browser by directly communicating
with it. Selenium WebDriver supports Java, C#, PHP, Python, Perl, Ruby.
Selenium Grid: Active

Selenium Grid is a tool used together with Selenium RC to run tests


on different machines against different browsers in parallel. That is, running
multiple tests at the same time against different machines running different
browsers and operating systems.
Selenium IDE: Integrated Development Environment

Features:

It is a Firefox browser plug-in and prototype tool

Is used to create and execute test cases using Mozilla Firefox Browser

(*Record Test Steps / Type test steps using element locators and selenium IDE commands)

User can edit Test Steps In Test Case (Add/Update /Delete)

Using Selenium IDE we can create Test Cases and form Test Batches / Suites/Set

We can export Selenium IDE Test Cases to other supported formats (Java / Ruby)

Users Can debug Test Cases and Insert comments

Disadvantages:

Support only Mozilla Firefox to execute / run test cases

Its does not support programming to enhance Test Cases

It does not support Parameterization / Data driven Testing


Selenium WebDriver:

Selenium WebDriver is powerful tool in this suite of tools.

Selenium WebDriver don’t have IDE and but having programming Interface

Selenium WebDriver is used to create and execute /run Test Cases

Testers /Users use Element Locators and WebDriver API Commands /Methods to create Test Cases

Selenium WebDriver supports various Bowsers, Operating environments and programming languages to
create Testcases / Test Scripts /Programs

Support Batch Testing ,Data driven Testing ,Cross Browser Testing and Data Base testing.

Google Chrome, Mozilla , MS edge , Safari , Opera

MS windows, Linux, MAC etc

Java, C# .Net, Python, python , Perl

Note: Selenium WebDriver is the only tool for creating and executing test cases. Selenium Grid is only
to execute Test Execution …

WebDriver: Sequential Testing

Grid : Parallel testing

Drawback of Selenium WebDriver:

Used for only web-based testing.

No Built-in-Result reporting facility

No Other Tool Integration for Test Management

Difficult configure selenium environment when it comes to other tools

4. Environments supported by Selenium

CUI : NO

Computer Software: Desktop applications - NO , Web Application - YES

Mobile Software:

Native Application : NO

Web Application : YES

Hybrid Application : NO
Note : Using Selenium Based Frameworks like Slendroid and Appium we can conduct testing for all types
of mobile applications.

5.Selenium License

Open source software and any one can download and use with free

6.Advantages of selenium

7.Disadvantages of Selenium

8.Testing frame works, and other frame works used in Selenium

9. Selenium Vs UFT/QTP

10.Selenium Environment setup

Selenium Test Process:

1. Planning
2. Generate Basic Test Case
3. Enhance Test Case
4. Run and Debug Test Case
5. Analyze Test Result and Report Defect

Selenium Tools and Setup Selenium Environment:

(Eclipse IDE , Java , Selenium Web Driver , Test NG Testing)

Download Eclipse IDE (Your OS compatible) and Extract

Download Java (JDK) (Your OS compatible software and install in your computer

Set Environment Variable path (Path variable)

Create Java Project In Eclipse IDE

Download Selenium Web Driver Java Language binding from seleniumhq.org, add those jar files to Java
project in Eclipse IDE

Launch Eclipse IDE, download TestNG software and Install

Download Browser Drivers

In Selenium Web Driver: How to design test scripts?

Using Element Locators and WebDriver API Commands (no recording) we write Test steps
Enhance Test cases:

1.Inserting Verification Points:

a. Using WebDriver Verification Commands

b. Using (Java) Programming Control Statements

c. Testing Framework Verification methods (TestNG)

2.Paramterization (Using Programming file handling feature)

In java: predefined libraries available for handling text / flat file

Download third-party jar files

3.Synchorization: using Java programming wait feature (Sleep time) or Selenium WebDriver command

4.Error Handling: Using programming feature (like Java exception handling)

5.Adding comments (to make the code / test script readable) and disable the code from execution.

In Selenium use Java comment syntax

Run and Debug Test Cases

Running Tests: Run Single test case and Run Test Batch

In Selenium WebDriver using Programming or using Testing Frame work we can do batch Test

Debug Test case: Locating and Isolating errors through step by step process

When debugging is required?

##################################################

Selenium Fundamentals

Java for Selenium

Selenium WebDriver

TestNG for Selenium

Selenium Project

##################################################

Java for Selenium: Selenium supports 6 programming languages and we use Java

Editions of Java

i) Java Standard Edition / Core Java (Old name is J2SE)


ii) Java Enterprise Edition / Advanced Java (Old name is J2EE)
iii) Java Micro Edition (Old Name is – J2ME)

 Selenium Automated Testing using Java Standard Edition is enough (Core Java)

Computer Programming:

Ex : data Types, Variables ,Operators ,Control Flow ,IO & File handling and Strings etc

Variables: To store the data the data in Computer Programming ( In temporary Memory )

Java : Objects and methods

Arrays: Objects in Java


Stings in Java : Objects

Java Standard Edition / Core Java (Old name is J2SE)

1.Comment: To make the code readable and Make code disable from Execution
Note: Java supports single line syntax and multi-line syntax.

2. Data types:

What is Data type?

Data that a Variable or Object can hold in programming.

Ex : Character , Integer , Float , String , Boolean , Date etc

Java supports 2 categories of data types:


primitive data types
b. non-primitive data types or reference Data types

3.Modifiers In Java
Modifiers are used to set access levels for classes, Methods and Variables
Java supports two categories of Modifiers
a. Access modifiers (default, public, private and protected)
b. Non-access modifiers (static, final and abstract.)

4.Variables: A named memory location to hold / store temporary data with in a program
Java supports three types of variables: Local variables, Instance variables, Static /Class variables

Note : Java supports explicit declaration of Variables only ( we need to declare first , before using )

Key words: if , for ,while , do ..ect

Reserve Key words: int , char, true , false ..

5.Operators in Java: Operators are used to conduct Mathematical comparison and Logical Operations

a. Arithmetic Operators

b. assignment Operators

c. Relational or Comparison Operators

d. Logical Operators

6.Java Control flow statements

a. Conditional or Decision Making ( if , switch )

b. Loop statements (for, while , do while and enhanced for )

c. branching statements: Break , continue and Return

7.Arrays in Java

Array is collection of similar type of elements. In Java Array is Object and we can use Array to store
series of values.

Each Item in array called as Element

9.IO operations and File handling in Java

IO operations: Read data using Input Devices (Mouse and Key Board)

Read data from files ( text , excel /data base)

Display the output on the console (Write Operation)

Write data to the files ( text / excel / Data base)

To handle text files use predefine classes like File Class etc..

To Handle Excel files download external jar file and add that Jar file to Java project and handle excel files

Three types of feature in Java:

1.Java Bulletin features (If condition, for Loop, System. Out.println)

2.Predifined features

3.External features
Selenium Class 6 : Java Part 2

10. Java Methods:

What is method?

Set of statements / Steps to perform an operation.

Why we use methods?

Methods are used for code reusability

When we choose to methods?

When ever we conduct operations multiple times, we conduct Methods.

Methods are known as functions.

Two types of methods in Java

i) Predefined Methods : String Methods , Number Methods ,Character Methods ,


Array methods
ii) User defined methods: Method with return a value (static and Non-static) and
Method without return value (static and non-static)

11.Exception Handling: Mechanism to handle Run time errors.

12. Java Object oriented Programing ( OOPS) :

Inheritance: Is a mechanism in which one object acquires all the properties and behaviors of Parent
object. Using inheritance, we can create classes that are built in upon existing class. We can inherit from
existing class, then we can reuse methods and fields from the parent class.

Java supports single inheritance, multi-level inheritance.

polymorphism: Performing tasks in 2 different ways.

Abstraction: Abstraction is a process of hiding the implementation details and showing functionality to
the user.

Encapsulation: wrapping code and data together in single unti.

Interfaces in Java : Collection of Abstract methods.

Constructer : Special type of Method that is used to initialize the object

Java Programming Hierarchy:


>Java Project

Java Packages

Java Class or Interface

Note : We write Java code in the class or Interface.

Uses of Java : Java is used to develop desktop applications ( Ex : Accor boat reader)

Web Applications: Sanp deals

Enterprise applications (banking , erp ,Insurance etc)

Mobile applications

Embed systems

Usage of Java language Elements in Selenium:

1.Comments: we can use comments in our test cases.

2.Modifiers:

3.DataTypes: We use data types for handling different type of data in our test cases

4.Variables: we use variables for soring data in our test cases.

5.Operators: We uses operations for Mathematical, comparison and Logical operators

6.Conditional Statements: we use to insert verification points and for error handling.

7.Loop statements: we use in data driven testing

8.Branching statements: we use “return “statements in user defined methods

9.IO operations: We use for handling Input and Output in our test cases

10.Java methods : we use for code reusability

11. Exception Handling: we use to handle run time errors in our test cases.
Selenium Class 7 : Java Environment setup :

Java Environment setup and verify the setup: In order to write and execute Java programs, Java
environment is required.

Three Imp steps in computer program:

1.Write a program

2.Compile the program (converting high level language to machine level language)

3.Run / Execute the program

Computer scripting: Only 2 steps

1.Write the script /program

2.Run the program

Steps for writing & Executing Java programs using command line prompt

Step 1 : Download Java software (JDK) and Install

Step 2 : Set environment variables path ( path variable)

Step 3 : write Java program in notepad and save the Java program file with .java extn

Step 4 : Compile the Java program from command line prompt and run it

Writing and executing Java programs using Eclipse IDE

Step 1 : Download Java software (JDK) and Install

Step 2 : Set environment variables path ( path variable)

Step 3 : Download Eclipse IDE and Extract

Step 4 : Write Java program on Eclipse IDE Editor and Run

Download Java software based on your operating system

Set Environment Path Variable

Navigation:

First copy JDK Bin dir path from your computer

Select This PC > RightClick>Properties>Advanced System Settings > Environment Variables

Slect PATH Variable from system variable > Edit > Paste “C:\Program Files\Java\jdk-10\bin”

OK

OK

OK
Step 1

Write a Java program in notepad Editor

public class sample1{

public static void main(String [] arg ){

System.out.println("Hello Jaav World");

Step 2: Compile the program

Launch Command prompt

Change to Java program File directory

Type javac filename

Note : It will create Java class file (.class file)

Step 3 : Run the Java program or class file

Launch command prompt

Change to Java program file directory

Type Java <file name> without extension

Example: Java sample1

Eclipse IDE : Eclipse IDE is a platform to write and execute computer programs like Java , Python , PERL ,
Ruby and PHP etc.

Open source software

It provides editor for writing programs, syntax guide, context help and auto compilation etc.

Java Program structure:

1.Documentation section

2. Package Statement

3.Import Statements

4. Class declaration

5.Interface section

You might also like