Reading Data From Excel File in Protractor

Reading Data From Excel File in Protractor

As we all are aware, data driven testing is one of the important aspects we need to take care while designing any testing framework. There could be different approaches of data Driven Testing in automation framework like
  •         Reading Test Data from properties file
  •         Reading Test Data from JSON File
  •     Using DataProvider
  •         Reading Test Data from excel

We already have seen in other blog, how to read data from properties file and use it in our automation framework. Please refer this link to know about it.

We also have seen how to Read test data from JSON file. Please click on this link.

In this blog, we will learn how to read data from Excel File and use them in our protractor automation framework.

For reading data from excel file in protractor automation framework, we need to follow below steps:

1)     We need to download the npm xlxs dependency from this link in your package.json.

2)     Then we can create one excel file inside our project and let's name it as GoogelTestData.With the help of this excel file I will read the url of google home page then click on Images link present on top of page and then do some search on google Search box.

3)     Now to Read this Excel File from our automation script we need to provide the path and name xlsx file.

Below is my runner class to execute this automation scripts

Output of above code execution would Be:



My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post
June 23, 2020 at 3:41 PM

How can we create excel file and write into it?