Zipping Multiple File Using Selenium Webdriver



Zipping Multiple File Using Selenium Webdriver

Lots of time we have a requirement in a project where we need to zip multiple files together and use it for some further testing like upload.

So In this blog we will learn how we can Bundle (zip) multiple files together in one zip file.

From java.util package java.util.zip.ZipOutputStream can be used to compress a file into ZIP format. Since a zip file can contain multiple entries, ZipOutputStream uses java.util.zip.ZipEntry to represent a zip file entry.


In this example scenario I will zip two files placed in my local at path D:\SampleFile



Below is the code snapshot with all the details

Result of Code Execution would be







SHARE THIS

Author:

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