Selenium Framework for Beginners 18 | How to use Excel for getting data in Selenium Java Framework
Also check this - https://youtu.be/B4G2tMDYjRQ
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/org.apache.poi/poi-ooxml
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
Видео Selenium Framework for Beginners 18 | How to use Excel for getting data in Selenium Java Framework канала Automation Step by Step - Raghav Pal
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/org.apache.poi/poi-ooxml
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
Видео Selenium Framework for Beginners 18 | How to use Excel for getting data in Selenium Java Framework канала Automation Step by Step - Raghav Pal
Показать
Комментарии отсутствуют
Информация о видео
10 августа 2018 г. 5:30:00
00:34:50
Другие видео канала
![Selenium Framework for Beginners 19 | Selenium TestNG How to get data from Excel using DataProvider](https://i.ytimg.com/vi/02ANy2pu_ZA/default.jpg)
![Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Testing Tutorial | Edureka](https://i.ytimg.com/vi/5FUdrBq-WFo/default.jpg)
![Selenium Framework for Beginners 7 | What is Page Object Model (POM) | How to create POM in Selenium](https://i.ytimg.com/vi/-0F-YBAQdGE/default.jpg)
![How to Read Data from Excel file in Selenium WebDriver](https://i.ytimg.com/vi/KN9gfMGaRAM/default.jpg)
![](https://i.ytimg.com/vi/t7RaxjfVM-M/default.jpg)
![Write Excel Files with Java](https://i.ytimg.com/vi/63IE7eHtR9s/default.jpg)
![Selenium Framework for Beginners 10 | What is Extent Reports | How to use Extent Reports in Selenium](https://i.ytimg.com/vi/eF_Vb-d4kIo/default.jpg)
![Write WebTable values into Excel Sheet in Selenium with Apache POI API](https://i.ytimg.com/vi/s2anoT8GHKE/default.jpg)
![How to Read Excel File in Selenium Webdriver Using Apache POI](https://i.ytimg.com/vi/sbBdj4zIMqY/default.jpg)
![Data Driven Test using Excel-Part1](https://i.ytimg.com/vi/8DaPdlhDpBc/default.jpg)
![Selenium Hybrid Framework Part-1 | e-Banking Automation Mini Project](https://i.ytimg.com/vi/M4Ye3SKT46g/default.jpg)
![Selenium Tutorial 5 -How to Handle Dropdown in Selenium Webdriver|Handle Dropdown using Select Class](https://i.ytimg.com/vi/M4l_HKmqp84/default.jpg)
![Apache POI Tutorial Part1 - How To Read Data From Excel #ApachePOI](https://i.ytimg.com/vi/ipjl49Hgsg8/default.jpg)
![](https://i.ytimg.com/vi/WLrCm4MODA4/default.jpg)
![Selenium Framework for Beginners 11 | How to use Extent Reports with TestNG in Selenium Java](https://i.ytimg.com/vi/PzmEiG08L78/default.jpg)
![How to Create Excel File using Apache POI | Selenium WebDriver |](https://i.ytimg.com/vi/q-fREhjTmNk/default.jpg)
![24. Cucumber Framework || Cucumber with Excel || Part - 1.](https://i.ytimg.com/vi/x7UVqzqf_5U/default.jpg)
![How to read excel in Java](https://i.ytimg.com/vi/B4G2tMDYjRQ/default.jpg)
![DataProvider In TestNG - Data Driven Framework in Selenium - Part 3](https://i.ytimg.com/vi/uatGjMOapK8/default.jpg)
![Selenium Framework for Beginners 14 | What is Log4j | How to add Log4j in java project](https://i.ytimg.com/vi/rbuR9Q_55h4/default.jpg)