Selenium Framework for Beginners 18 | How to use Excel for getting data in Selenium Java Framework
Also check this - • How to read excel in Java Website - https://automationstepbystep.com/ Today we will learn Why to use excel files How to add excel libraries How to create excel read function GetRowCount GetCellData How to call excel functions helpful tips Free Courses - https://automationstepbystep.com/ Why to use excel file In Selenium we can get data from external files like excel and csv MS Excel is most commonly used Helps to make our scripts independent of data handling Helps to add, update, manage data separately (outside the framework) Helps to make our framework data driven How to add excel libraries Step 1 Add apache poi libraries Download and add Jars from : https://poi.apache.org/download.html OR Add maven dependency From : https://mvnrepository.com/artifact/or... Step 2 Check if the libraries are added in your project Get Row Count Step 1 Create excel file and add some data Step 2 Create references for Workbook for new excel format (xlsx) XSSFWorkbook workbook = new XSSFWorkbook(“excel file location”); for old excel format (xls) HSSFWorkbook workbook = new HSSFWorkbook(“excel file location”); Step 3 Create references for Worksheet XSSFSheet sheet = workbook.getSheet(“sheet name”); Step 4 Call row count function sheet.getPhysicalNumberOfRows(); Get Cell Data Step 1 Create references for Workbook XSSFWorkbook workbook = new XSSFWorkbook(“excel file location”); Step 2 Create references for Worksheet XSSFSheet sheet = workbook.getSheet(“sheet name”); Step 3 Call function to get cell data sheet.getRow(rownum).getCell(colnum).getStringCellValue(); sheet.getRow(rownum).getCell(colnum).getNumericCellValue(); How to call excel functions Step 1 In all excel functions get rowNum, colNum as parameters This is to avoid hard coding of values and get the values from calling function Step 2 Create a constructor A constructor is a special method without any return type and name same as the class name Constructor is called every time a class object is created using the new() keyword Step 3 Parametrize the constructor To get excel path and sheet name Step 4 Create a new class to call excel functions Like, Subscribe & Share You can support my mission for education by sharing this knowledge and helping as many people as you can Never Stop Learning Raghav

Selenium Framework for Beginners 19 | Selenium TestNG How to get data from Excel using DataProvider

Selenium Framework for Beginners 14 | What is Log4j | How to add Log4j in java project

Selenium Framework for Beginners 1 | Getting Started | How to setup Selenium Java project in Eclipse

Don’t Throw Away Old Phones! Put One Behind Your WiFi Modem and Watch What Happens!😱

Selenium Framework for Beginners 23 | TestNG Grouping | How to group tests

What Life in China is REALLY Like for Single Women (Utopia or Exhausting Grind?)

Selenium Framework for Beginners 20 | What are TestNG Listeners | How to use TestNG Listeners

Let’s Handle 1 Million Requests per Second, It’s Scarier Than You Think!

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup

How Hackers Steal Passwords: 5 Attack Methods Explained

Selenium Framework for Beginners 33 | What is AutoIT | How to use AutoIT with Selenium

I Tried Every Major Linux Distro So You Don't Have To (Here's What I Found)

Selenium Framework for Beginners 11 | How to use Extent Reports with TestNG in Selenium Java

APIs for Beginners - How to use an API (Full Course / Tutorial)

Complete GitHub Actions Course - From BEGINNER to PRO

Selenium Framework for Beginners 8 | How to implement POM in Selenium Java

Part 1: Selenium with Java+Cucumber(BDD) Framework Development from Scratch

Model Context Protocol (MCP) Explained for Beginners: AI Flight Booking Demo!

