Java Programming for Selenium


Java for Selenium
 

Java Programming for Selenium

Why Java for Selenium?
 

> Selenium written inwards Java, It does hateful that Java exclusively to a greater extent than compatible amongst Selenium,  nosotros tin strength out usage other supported languages also.

> Good back upwards for Selenium amongst Java, You tin strength out larn to a greater extent than assistance documentation too code implementations from internet.

> Majority of Selenium Testers (nearly 77%) using Java, therefore noesis sharing is real easy.

> Java is platform independent language, nosotros tin strength out usage Java on whatever Operating environment.
-------------------------------------------
How much Java is required for selenium?
 

> For Test Automation using Selenium Core Java is sufficient, Advanced Java is non required.

> Java Fundamentals too OOPS (Object Oriented Programming System) concepts are required.

We tin strength out segregate Java for selenium inwards to 2 categories.
A) Java Fundamentals

B) Java OOPS Concepts
---------------------------------------------------
A) Java Fundamentals

i) Comments inwards Java
 

    > To brand the code Readable
    > To brand the code disable from execution.

Java supports Single trouble comment too multiple lines comment.
--------------------------------------------
ii) Data Types inwards Java
 

A information type is a classification of the type of information that a variable or object tin strength out concur inwards figurer programming.

Example:

Integer

Character

String

Float

Boolean etc...

Java supports 2 categories of Data types

a) Primitive Data Types

b) Reference Data Types
----------------------------------------
iii) Java Modifiers
 

Modifiers are used to laid access levels for Classes, Variables, too Methods etc...

a) Access Modifiers (Default, Public, Private too Protected)

b) Non Access Modifiers(Static, Final, Abstract, Synchronized etc...)
----------------------------------------------------
iv) Variables inwards Java
 

> Influenza A virus subtype H5N1 named retention place to shop temporary information inside a program

Three types of Variables inwards Java

a) Local Variables

b) Instance variables

c) Class / Static Variables
------------------------------------
v) Operators inwards Java
 

Operators are used to perform Mathematical, Comparison too Logical operations.

Categories of operators

a) Arithmetic Operators

b) Relational Operators

c) Bitwise Operators

d) Logical Operators

e) Assignment Operators

f) Miscellaneous Operators
-----------------------------------------
Flow Control Statements    

    Conditional Statements
    Loop Statements

vi) Conditional Statements
 

a) If Statement

b) Switch Statement
------------------
Types of Condition

a) Single Condition (Positive/Negative)

b) Compound Condition

c) Nested condition
-----------------------
Usage of Conditional Statements

a) Execute a block of statements when status is True.

b) Execute a block of statements when status is True, otherwise execute to a greater extent than or less other block of statements.

c) Decide amid several alternates (Else If)

d) Execute a block of statements when to a greater extent than than 1 status is True.(nested If)

e) Decide amid several alternates (Switch statement)
-------------------------------------------------
vii) Loop Statements
 

Used for Repetitive execution.

Four Types of Loop structures inwards Java

a) For loop

b) While loop

c) Do While loop

d) Enhanced For loop (arrays)
------------------------------------------------
viii) Arrays inwards Java
 

> Generally, Array is a collection of like type of elements.

> In Java, Array is an Object that contains elements of like information types.

> Java Array is index based, index starts from Zero.

> The length of an Array is established when the Array is created too Array length is fixed.

> Each item inwards an Array is called an Element.
---------------------------------------------
ix) Java Methods
 

Methods are every bit good known every bit Functions.

In structured programming (Ex: C Language) nosotros usage Functions(Built-in too User defined),
In Object oriented programming nosotros usage Methods (Built-in too User defined).

Basically Methods are Two types.

a) Built inwards Methods    Number Methods
    Character methods
    String Methods
    Date & Time Methods
    etc...

b) User defined Methods    

    Method amongst returning value
    Method without returning whatever value.
--------------------------------
x) Regular Expressions   
 

> It is a Formula for matching patterns, Influenza A virus subtype H5N1 Regular aspect defines search designing for Strings.

Java provides java.util.regex parcel for designing matching.
----------------------------------------
xi) IO Operations too File treatment inwards Java
 

The java.io parcel contains classes to perform Input too Output operations.

> Read information using Input devices.

> Display output on the Console.

> Read too Write Text files too other file.

Using Java File course of pedagogy nosotros tin strength out handgrip Text files.
--------------------------------------------
xii) Exception treatment In Java
 

In Computer programming, Exception is an abnormal condition.

> An exception is an final result that occurs during the execution of a programme that disturbs the normal catamenia of instructions.

> The exception treatment inwards coffee is 1 of the powerful machinery to handgrip the Run-time errors therefore that normal catamenia of the programme tin strength out last maintained.
-------------------------------------------
B) Java Object Oriented programming System (OOPS) concepts.
 

Four Fundamentals of OOPS
 

i) Inheritance

ii) Polymorphism

iii) Abstraction

iv) Encapsulation
------------------------------------
i) Inheritance
 

> Inheritance is a machinery inwards which 1 Object acquires all the properties too behaviors of Parent object.

> using Inheritance nosotros tin strength out exercise Classes that are built inwards upon existing classes.

> When nosotros Inherit from an existing class, too therefore nosotros tin strength out reuse Methods too fields from
Parent course of pedagogy too nosotros tin strength out add together novel methods too fields.

Java Supports:

a) Single Inheritance

b) Multi Level Inheritance

c) Hierarchal Inheritance

Note: Java doesn't back upwards Multiple Inheritance.
-----------------------------------------------------------
ii) Polymorphism
 

Performing task/s inwards dissimilar ways.

Polymorphism derived from 2 Greek words,

Poly-means Many

Morphs -means forms/ways

So polymorphism way many ways.

Two types of Polymorphism inwards Java

a) Compile Time Polymorphism

b) Run-time Polymorphism

Note: We tin strength out rank Polymorphism past times Method Overloading too Method Overriding.
-------------------------------------------------------------
iii) Abstraction
 

> Abstraction is a procedure of hiding the implementation details too showing functionality to the user.

> In to a greater extent than or less other way it shows of import things to the user too hides internal details.

Ex: Sending email

> Abstraction focuses on what the Object does instead of how it does.

Abstraction tin strength out last achieved inwards 2 ways

a) Abstract Class(0 to 100%)

b) Interface (100%)
-------------------------------------------
iv) Encapsulation
 

> Encapsulation is a procedure of wrapping code too information together into a unmarried unit.

Ex: Capsule (mixed of several medicines)

It provides command over the data.
-----------------------------------------------------
Java Packages
 

A Java parcel is a like type of classes, interfaces too sub packages.

Two types of Packages inwards Java

a) Built inwards Packages

Ex: io, util, sql etc...

b) User defined Packages
--------------------------------------
Interfaces inwards java
 

> An interface is a collect of abstract methods.

> An Interface is non a class, writing an interface is like to writing a class, exactly 2 are dissimilar concepts.
-----------------------------------
Java Programming hierarchy
 

Java Project
 > Java Package
   >Java class/ Java Interface

Note: We write Java code inwards the Class or Interface.
----------------------------------------------------

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post