0% found this document useful (0 votes)
4 views

java for selenium

The document provides a comprehensive introduction to Java programming, focusing on Core Java essentials necessary for Selenium automation. It includes detailed steps for installing Java JDK 8 and Eclipse IDE, creating and executing Java projects, understanding Java syntax, and utilizing various programming constructs such as variables, data types, operators, control flow statements, methods, classes, and arrays. Additionally, it covers the importance of comments, compiler errors, and the String class in Java.

Uploaded by

abhimanyu thakur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

java for selenium

The document provides a comprehensive introduction to Java programming, focusing on Core Java essentials necessary for Selenium automation. It includes detailed steps for installing Java JDK 8 and Eclipse IDE, creating and executing Java projects, understanding Java syntax, and utilizing various programming constructs such as variables, data types, operators, control flow statements, methods, classes, and arrays. Additionally, it covers the importance of comments, compiler errors, and the String class in Java.

Uploaded by

abhimanyu thakur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

DAY 12

Introduction to Java
Core Java

Introduction to Java

Java is a Programming language.


Java can be divided as below:

For automating the test cases using Selenium, we need to learn Core Java. (i.e. Advanced Java is not required for
Selenium)

Java Installation

We have to install Java JDK 8 of 32 bit version in our machines.

The below are the steps for installing Java JDK 8:

Google 'Java JDK 8'


Accept the license agreement
Click on the Windows x86 version of Java to download
Install the downloaded .exe file of Java JDK 8
Configure Java
by providing the Java home path in the Environment Variables > JAVA_HOME
by providing the path of the bin folder of JDK in the Environment Variables > Path
Execute 'java -version' in the command prompt to confirm the installation and configuration of Java JDK 8

Eclipse IDE Installation

The below are the steps for installing Eclipse IDE:

Google 'Eclipse IDE' and select the search result that appears on the top
Select 'Eclipse IDE for Java EE Developers'
Select 'Windows 32 Bit'
Click on 'Download'
Extract the downloaded ZIP file
DAY 13

Java - Part 2
Eclipse IDE Installation (Continuation)

Double Click the Application file to launch Eclipse IDE and specify Workspace path
Pin the Application file to the Task Bar

Java Project Creation & Execution

The below are the steps for creating a Java Project in Eclipse IDE:

Right click in the 'Project Explorer' and select 'New > Project > Java Project'
Provide 'Project Name' and click on 'Finish' button
Right click on the 'src' folder and select 'New > Class'
Provide 'Class Name', select the checkbox for main method and click on 'Finish' button
Write a sample Java statement - System.out.println("Hello World!");
Right click on the .java file and select 'Run As > Java Application' to execute the Java program

Understanding Java Programs

In Java programs, we have to enclose everything inside a Class.


Syntax: public class ClassName { }
Thisclass term is used as syntax to create/define a Class in Java
In Java programs, execution starts from the main method
Syntax of main() method - public static void main(String args[]){ }
All the Java statements in Java should end with ';' symbol
Example for a Java Statement is nothing but print statement - System.out.println("Hello World");
All the Java statements should be written inside the methods
We generally write code which is nothing but a set of statements inside the methods
Keywords like public, static, void and String args[] will be explained later

Compiler Errors

Java Complier Errors will be displayed when we make syntax mistakes in the Java Code:

Example: All the Java statements in Java should end with ';' symbol
Remove the ; from the end of Java Statement
Example: Java is case sensitive
Replace 'S' with 's' in the statement
Example: Remove any of the closing brace
DAY 14

Java - Part 3
Print Statements

Print statements in Java are used to print the program output to the console.

The below are the two types of print statements in Java:

Demonstrate print statements


Demonstrate println statements
Demonstrate printing a number and text

Comments

Comments provided in a Java program won't be executed and are generally used to explain the underlined code.

The below are the two types of comments in Java:

Demonstrate single line comments


Syntax: // Sample Comment Text
Demonstrate multi line comments
Syntax: /* Sample Comment Text */

Variables, Data Types, Operators and Literals

In order to store the data in Java programs, we need to use Variables, Data Types, operators and Literals.

Example: int a = 5;
Refer more details here
Demonstrate a program which stores the data into a variable and prints it

Variables

Variable is a name provided to a reserved memory location.

Refer more details here


There are two types of Variables:

Local Variables
A variable which is declared inside the method is called local variable (Demonstrate here)
Instance Variables
A variable which is declared inside the class but outside the method is called Instance variable (Demonstrate
here)
We have to specify the static text before the instance variable as the method which is going to use this
variable is a static method
This concept will be explained in upcoming sessions.
DAY 15

Java - Part 4
Data Types

We can define the variables with different Data types, based on the type of data to be stored.

The below are the different data types in Java:

But while working with Selenium, we only need int, double, char, boolean and String
int
Integer values can be stored into a variable which is declared with int data type
Example: int a = 5;
Demonstrate storing integer values into a variable which is declared with int data type
double
Decimal values can be stored into a variable which is declared with double data type
Example: double b = 6.73;
Demonstrate storing decimal values into a variable which is declared with double data type
char
Single character can be stored into a variable which is declared with char data type
Example: char c = 's';
Demonstrate storing a single character into a variable which is declared with char data type
boolean
true / false can be stored into a variable which is declared with boolean data type
Example: boolean d = true;
Demonstrate storing a boolean value into a variable which is declared with boolean data type
String
Sequence of characters can be stored into a variable which is declared as String
Example: String e = "This is a sample text";
Demonstrate storing a sequence of text into a variable which is declared as String

Operators

Operators are just symbols used to perform operations on the provided data.

The below are the different types of Operators in Java:

Demonstrate all Operators here


Demonstrate Arithmetic Operators
Demonstrate Relational Operators
Demonstrate Logical Operators
Demonstrate Assignment Operators
Demonstrate Conditional Operator
DAY 16

Java - Part 5
Operators (Continued)

The below are the different types of Operators in Java:

Demonstrate all Operators here


Demonstrate Arithmetic Operators
Demonstrate Relational Operators
Demonstrate Logical Operators
Demonstrate Assignment Operators
Demonstrate Conditional Operator

Flow Control

Flow Control describes the order in which statements will be executed at run time.

There are different types of flow control statements and can be categorized as below:
Selection Statements

Selection Statements have one or more conditions which return either true or false when evaluated.

Based on the returned value, the set of code will be executed.

When condition is true, the set of code will be executed.


When condition is false, the set of code wont be executed.

Different types of Java Selection Statements:

if statements
Code inside the if decision making statement executed only when the condition provided inside if decision
making statement returns true. (View screenshot here)
Syntax (View screenshot here)
Demonstrate if decision making statement
Demonstrate the execution of the statements inside if block when the if condition is
true. (Demonstrate here)
Demonstrate that statements inside if block are skipped from execution when the if condition is false.
(Demonstrate here)
if ... else statements
While using if ... else decision making statement, code inside if block gets executed when the if condition is
true and code inside else block gets executed when the if condition is false. (View screenshot here)
Syntax (View screenshot here)
Demonstrate if else decision making statement
Demonstrate the execution of statements inside if block when the if condition is true (Demonstrate
here)
Demonstrate the execution of statements inside else block when the if condition is false (Demonstrate
here)
if ... else if ... else statements
if .. else if .. else statements contains more than one conditions. If the first if condition returns false, the
code inside the if block will be skipped and control will be taken to the next conditions i.e. else if conditions.
If all the else if conditions return false, the code inside else if blocks will be skipped and the code inside the
else block without condition will be executed. (View screenshot here)
Syntax (View screenshot here)
Demonstrate the program when all the if and else if conditions have returned false and code inside
the else block is executed (Demonstrate here)
Demonstrate the program when the if condition has returned true and code inside the if block got
executed skipping all the remaining else if and else blocks (Demonstrate here)
Demonstrate the program when one of the else if condition has returned true and code inside that
else if block got executed skipping all the remaining if, else if and else blocks (Demonstrate here)
switch statements
Based on result of a condition expression, switch case chooses one of many possibilities. (View screenshot
here)
Syntax (View screenshot here)
The result of a condition expression needs to result a int or character or a string value.
Demonstrate switch case (Demonstrate here)
Demonstrate switch case which dont match any case and executes the code in the default section.
(Demonstrate here)
Demonstrate what happens when we dont provide break; statements inside the cases. (Demonstrate
here)
DAY 18

Java - Part 7
Iterative Statements

Iterative Statements helps us in executing the same block of code multiple times.

Iterative Statements executes the same set of code until the loop condition is satisfied. (View screen-shot here)
Different types of Iterative Statements:

while loop
while loop executes the same block of code multiple times i.e. until the boolean condition turns false.
while loop tests the condition before executing the code in loop body. (View here)
Syntax: View here
Demonstrate while loop
Demonstrate the while loop when the condition is always true (Demonstrate here)
Loop will be iterated infinite times as the condition is always true
Demonstrate the while loop when the condition is false (Demonstrate here)
Loop wont be executed at-least once as the condition is false.
Demonstrate the while loop where the condition is initially true and after few iterations is turned false
(Demonstrate here)
Loop will be executed until the condition turns false.
do while loop
do-while loop works similar to while loop, but the block of code will be executed at-least once even after the
condition is false
Unlike while loop, do-while loop tests the condition after executing the code in loop body. (View here)
Syntax: View here
Demonstrate the do-while loop where the condition is initially true and after few iterations has turned false
(Demonstrate here)
Loop will be iterated multiple times until the condition becomes false
for loop
for loop is the most commonly used loop in Java and is used when we know the number of iterations in
advance.
for loop executes the same block of code multiple times, until the boolean condition turns false.
Though while loop and for loop work in the similar manner, while loop is preferred over for loop when we
dont know the number of iterations in advance. (View here)
Syntax: View here
Demonstrate the for loop when the condition is initially true and after few iteration has turned false
(Demonstrate here)
Loop will be iterated multiple times until the condition becomes false
for-each loop
Will be explained later, as it is generally used with Arrays and Collections.

Transfer Statements

Transfer statements are used to transfer the flow of execution from one block of code to a different block of code.
Different types of Transfer Statements:

break;
The purpose of the break; statement is to come out of the statements based on some condition.
Demonstrate the usage of break; statements inside any loop statement (Demonstrate here)
continue;
The purpose of the continue statement is to skip the current iteration of a loop based on some condition and
continue with the next iteration.
Demonstrate on how to use continue; statements inside any loop statement (Demonstrate here)
return
Will be explained later, as it is used with methods.
try, catch, finally
Will be explained later, as it is used in Exception Handling
DAY 19

Java - Part 8
Methods

In Java programming, programming logic needs to be written inside methods:

main() method is a method where the program execution starts and we can write programming logic inside the
main() method - Demonstrate here

Demonstrate creating multiple methods along with the below - Demonstrate here
Creating multiple methods along with main() method
All the method should reside inside the Class
main() method calling other method
non-main() method calling other method
method() calling other method multiple times

Demonstrate single, multiple parameterized methods and passing arguments to those methods - Demonstrate here
Create a single parameterized method
Create a multiple parameterized method
Call the single and multiple parameterized methods by passing the arguments while calling

Demonstrate returning the values back to the calling methods - Demonstrate here
Return nothing from a method
Return int value from a method
Return String value from a method
DAY 20

Java - Part 9
Classes and Objects

Class encloses variables and methods - Demonstrate here

Class is a template used for creating Objects


Demonstrate creating a Class and use the Class as a template for creating Objects - Demonstrate here
Create a Class having a main method say Demo
Inside the same Java file create another Class named Car
Create any variables inside the Car class say model, cost, color
Create any methods inside the Car class say startCar(), stopCar(), carDetails()
Create any objects using Car class
Initialize and Access the variables & methods of Objects
Object Creation Statement
Car benz = new Car(); - View here

Arrays

Using Arrays, multiple values of same data type can be stored into a single variable.
Arrays can be categorized as below:
DAY 21

Java - Part 10
Arrays (Continued)

Single Dimensional Array


Example: int[] a = new int[3];
Demonstrate Declaring, Creating, Assigning and Accessing the single dimensional Array - Demonstrate here
View the diagrammatic representation of single dimensional array here
Shortcut representation of single dimensional array - Demonstrate here
'length' predefined variable of Arrays - Demonstrate here
Using for loop with single dimensional arrays - Demonstrate here
Using for-each loop with single dimensional arrays - Demonstrate here

Two Dimensional Array


Example: int[][] a = new int[2][3];
Two dimensional Array is nothing but array of single dimensional arrays.
View the diagrammatic representation of two dimensional array here
Demonstrate Declaring, Creating, Initializing and Accessing the two dimensional Array - Demonstrate here
Shortcut representation of two dimensional array - Demonstrate here
DAY 22

Java - Part 11
Arrays (Continued)

Two Dimensional Array

'length' predefined variable of Arrays - Demonstrate here


Using for loop with two dimensional arrays - Demonstrate here

Arrays and Object Class


Object Class is the parent class of all the classes in Java and is the top most class of Java
As Object Class is the parent class of all the Classes in Java, we can assign any type of data into the variable
which is declared as Object Arrays type. - Demonstrate here

Disadvantages of Arrays
Arrays are fixed in size. Once the Array is created, there is no chance of decreasing or increasing the size of
the array.
Collections are used to overcome the above disadvantages, which will be explained in the future sessions.

String

String is not a data type, instead it is a predefined class in Java Class Library

Google "Java 8 API" and find the String class in the Java Class Library
Actual Representation of String - String s = new String("Sample Text"); - Demonstrate here
Shortcut Representation of String - String s = "Sample Text"; - Demonstrate here
Concatenate two strings
using '+' operator - Demonstrate here
Predefined methods of String class - Out of all the predefined methods of Strings, the below are the methods which
are useful as part of Selenium Automation:
Using equals() method to compare two strings - Demonstrate here
Using length() method to find the length of String literal text - Demonstrate here
Using substring() method to retrieve the portion from the actual String text - Demonstrate here
Using trim() to remove the spaces before and after the string text - Demonstrate here
Using indexOf() to check whether the provided text is in the provided paragraph. - Demonstrate here
Returns -1 in case the provided text is not available
Using split() method to split the text into different parts based on the provided text, symbol or space.
DAY 23

Java - Part 12
Wrapper Classes and Primitive Data types

In order to use primitive data types as Objects, we have to use Wrapper Classes which help us in converting the primitive data types
into objects.

The below are the different primitive data types:

For, all the above data types, there are corresponding Wrapper Classes as shown below:

Demonstrate a program which uses Wrapper Classes for converting the primitive data types into Objects and Objects into
primitive data types - Demonstrate here

Constructors

Constructors are similar to methods, but have the below differences:

Demonstrate the constructors having the below qualities here


Constructors have the same name as Class name
Constructors are automatically called when an object is created for the Class
Constructors won't have any return type - Return types like void, int etc won't be available for constructors
Empty hidden Constructor will be called, when an object is created for the Class not specified with explicit constructors
Constructors simplify the initialization of variables
Demonstrate initialization of variables without using constructors - Demonstrate here
Demonstrate initialization of variables with constructors - Demonstrate here

this keyword

The purpose of the this keyword is to differentiate the instance variable with the parameterized variables of methods/constructors.

Using this keyword with methods


Demonstrate the program which dont use this keyword - Demonstrate here
Demonstrate the advantage of using this keyword with methods - Demonstrate here
Using this keyword with constructors
Similar to methods.
DAY 24

Java - Part 13
Overloading

Duplicate methods/constructor names are allowed inside the same class, as long as their parameters count or declaration
are different.

method overloading
Two or more methods having the same name can be created inside a single class as long as their
parameters count or declaration are different.
In this case, the methods are said to be overloaded and the concept is knows as Method overloading
Compiler error will be displayed when more than one method has the same name - Demonstrate here
Demonstrate how method overloading concept can avoid compiler error - Demonstrate here
constructor overloading
The same concept of method overloading when applied to constructors is known as constructor overloading
In this case, the constructors are said to be overloaded and the concept is known as Constructor
overloading

Packages

Packages are created to group related classes/interfaces/other files.

We generally group things to organize them better for locating them easily.
Default package - Create a new Java project say Facebook and Create a new Java Class say 'FacebookLogin' and
observed that a default package will be created. - view here
Package creation - Create a new Java project say Facebook and group the Classes under various packages - view
here
Demonstrate - Accessing instances variables and methods from other class which is under the same package
Demonstrate - Importing the Classes in the other packages while accessing the instance variables and methods
created in the Classes which are under other packages
Demonstrate - Using * in the import statements to import all the classes in the package instead of importing a
single class every time

Inheritance

Inheritance is a mechanism in which one class acquires the properties (i.e. variables and methods) of another class

The purpose of this Inheritance is to use the properties (i.e. methods and variables) inside a class instead of
recreating the same properties again in new class.
Child class acquires the properties (i.e. variables and methods) of Parent Class.
Child class uses extends keyword to inherit the properties from parent class
Demonstrate a child class which inherits the properties from Parent Class - Demonstrate here
Child class can have specific properties (i.e. variables and methods) which are not available in the parent
class
Object created for parent class can access the variables and methods that are created in parent class only. It
cannot access the child class properties.
Object created for child class which is inheriting the parent class can access the variables and methods of
both parent class and child class.
DAY 25

Java - Part 14
Overriding

When a method in the Child class (i.e. sub-class) is duplicate of a method in Parent class (i.e. super-class) , then the
method in the sub-class is said to override the method in super-class.

When we create an Object for Sub-class and call the overridden method, the method in the sub-class will be called
- Demonstrate here
Even though the name of the method in the sub-class has the same name as a method in super-class, if the type of
parameters or number of parameters, then the method in the sub-class will overload the method in super-class
instead of overriding
Constructors cannot be overridden as the name of the constructor needs to be same as the name of the Class.

Modifiers

Modifiers in Java can be categorized as below:

public Access Modifier

Classes/variables/methods specified with 'public' access modifier can be accessed directly by the classes which are
in the same package - Demonstrate
Classes/variables/methods specified with 'public' access modifier can be accessed by the classes outside the
package after importing the classes - Demonstrate

private Access Modifier

Java classes cannot be specified with 'private' access modifier - Demonstrate


variables/methods specified with 'private' access modifier can be accessed only with in the same class -
Demonstrate

default Access Modifier

When no modified is specified before classes/variables/methods, then we name it as default modifier - Demonstrate
default means public to all the classes inside the same package and private to the classes which are outside the
package - Demonstrate

protected Access Modifier

protected means public to all the classes inside the same package and private to all the classes which are outside
the package except child classes
Java classes cannot be specified with 'protected' access modifier - Demonstrate
While accessing the protected variables/methods outside the packages using sub-classes, we don't have to create
an object to access them as they are inherited variables and methods - Demonstrate
DAY 26

Java - Part 15
Modifiers (Continued)

static Non-Access Modifier

Java classes cannot be specified with 'static' non-access modifier - Demonstrate


Variables declared directly inside the class but outside the methods and are specified with 'static' modifier are
known as static variables
Memory allocated to the static variables is different from the memory allocated to the instance variables - view here
static variables needs to be accessed with the help of Class name, as they belong to the Class memory - View here
static variables are generally used to store common data, where as Object variables/Instance variables are used to
store Object specific data.
wheels variable can be used as a static variable/class level variable as it has common data i.e. wheels count
is 4 for all the cars in the market
Where as cost variable cannot be used as a static variable as its value changes from car to car, hence we
use it as an Object variable/Instance variable.
static can also be used with methods
static can only access static stuff
You have to create object to overcome this

final Non-Access Modifier

The value of the variable cannot be changed on specifying it with final non-access modifier - Demonstrate here
final modifier specified classes cannot be inherited/extended by other classes - Demonstrate here
final modifier specified methods in a class cannot be overridden by its sub-classes - Demonstrate here

abstract Non-Access Modifier

variables cannot be specified with 'abstract' non-access modifier - Demonstrate


On specifying a method with abstract modifier, we can just declare the method without implementing it -
Demonstrate here
Classes having at-least one abstract specified method must be specified as abstract
Sub-Class inheriting the Super-Class needs to implement the abstract specified methods in Super-Class -
Demonstrate here
Purpose of abstract methods - Used when the super-class dont have to implement everything, and when the
sub-classes inheriting the super-class needs to implement them.
Objects cant be created for abstract classes, we have to create a Sub-Class and access its variables/methods using
Sub-Class object reference - Demonstrate here
DAY 27

Java - Part 16
Interfaces

The purpose of an interface is to just to declare all the functionalities required before actually implementing them.

Interfaces looks similar to Classes and are extensions of abstract classes


Create an interface say 'Bank' in Eclipse IDE and create variables & methods inside it as shown here
Variables in the interfaces are of static and final type
In abstract classes, we can have both methods (i.e. implemented and non-implemented), where as in interfaces,
we cannot implement any methods.
Classes use implements keyword to implement any interface - Demonstrate here
Classes implementing an interface can have their own specific methods apart from methods which are acquired
from an interface - Demonstrate here
Objects cannot be created for an interface - Demonstrate
Object can be created for the Classes which are implementing the interfaces, for accessing interface defined
methods and class specific methods - Demonstrate
Follow the below steps to provide the access the interface specific methods and not to access the class specific
methods
Create an object for the Class which is implementing the interface
Assign the object of the class to the interface reference variable
Using the interface reference variables, we can now access only the methods which are declared in the
interface - Demonstrate here
DAY 28

Java - Part 17
Exception Handling

Exception is nothing but an error which is occurred during runtime i.e. during program execution

If an exception has occurred during program execution at any step, the steps which are after the exception wont be
executed - Demonstrate here

try catch blocks

We can handle the exceptions using the try catch blocks


Handling the exceptions is known as Exception Handling
Syntax: View here
Explain the flow of try catch block - view here
Demonstrate a program having code to handle the exception using try catch blocks - Demonstrate here
In the above Syntax image, 'Exception' is the Class name and 'e' is the object reference which can catch the
exception (i.e. object) thrown from try block

Exceptions Hierarchy

Demonstrate ArithmeticException and handle it using 'ArithmeticException' class in catch block - Demonstrate here
Demonstrate ArrayIndexOutOfBoundsException and handle it using 'ArrayIndexOutOfBoundsException' class in
catch block - Demonstrate here
Exception class is the parent class of all the Exception Classes like ArithmeticException
and ArrayIndexOutOfBoundsException classes and can handle them
Throwable class is the grant parent class of all the Exception Classes like ArithmeticException
and ArrayIndexOutOfBoundsException classes and can handle them
DAY 29

Java - Part 18
Exception Types

Exceptions can be categorized as below:

Unchecked exceptions are the exceptions that are not checked by compiler and will occur only during execution -
Demonstrate AirthmeticException
Checked Exceptions are the exceptions that are checked by the compiler - Demonstrate FileNotFoundException
Handling Checked Exceptions using try .. catch block
Ignoring Checked Exceptions using throws keyword
DAY 30

Java - Part 19
Handling Files

The purpose of handling files in Selenium is to read the text from the Files. (Demonstrate here)

Using File Class represent a file in Java, which is available outside the Project workspace.
Using File Class represent a file in Java, which is available inside the Project workspace.
Read a File in Java and print every line in the file to the output console
Optimize the reading and printing from a File using while loop

Collections Framework

Collection is a group of individual Objects.

Array's are fixed in sized, where as Collections are grow-able in size


Though Collections Framework is a vast subject, we have to only learn the below for Selenium:

ArrayList
ArrayList is nothing but a re-sizable array and is not of fixed size
Demonstrate an ArrayList which stores integer values and uses for loop to print those values - Demonstrate
here
Demonstrate an ArrayList which stores different types of values and uses for each loop to print those values
- Demonstrate here
Assigning the object of ArrayList class to Collection / List Interface - Demonstrate
DAY 31

Java - Part 20
HashSet
Unlike ArrayList, HashSet wont have index values and hence we cannot use for loop with HashSet
Unlike ArrayList, HashSet stores the values in a random order
Demonstrate HashSet which stores integer type of values and uses for each loop to print those values -
Demonstrate here
Assigning the object of HashSet class to Collection / Set Interface - Demonstrate
Iterator interface and iterator() method
iterator() is a predefined method of Collection interface, who's return type is Iterator interface
hasNext() and Next() are the predefined methods of the Iterator interface
Demonstrate using Iterator and iterator() with ArrayList - Demonstrate here
Demonstrate using Iterator and iterator() with HashSet - Demonstrate here
HashMap
Instead of storing the objects as a group of Objects, HashMap stores the objects in the form of key value
pairs.
Demonstrate a HashMap which stores different key value pairs and uses get() method to retrieve a value
based on the provided key - Demonstrate here
Demonstrate a HashMap which stores different key value pairs and uses for each loop to print those values -
Demonstrate here

Calling the methods using String text (Reflection API)

In Selenium Automation, we need to read the values from the Excel file and call the appropriate methods having the same
names as the values.

Demonstrate a program which calls a method having the same name as String text - Demonstrate here
Demonstrate a program which calls a parameterized method having the same name as String text - Demonstrate
here
Purpose - In Selenium Automation, we need to read the values from the Excel file as Strings and call the
appropriate methods having the same names as the String text.

You might also like