Capture link and save in excel


I am testing a link that redirect me every-time to a different site.
I would like to capture the site I got redirected to and save it in excel file or save it elsewhere.
Any ideas or suggestions ?



I needed to write data to excel. I created Custom Keyword for that.
Under Keywords right click and select NEW -> PACKAGE.
Name it writeToExcel (or however you want)
After that right click your package and select NEW -> KEYWORD.
Name it WriteExcel (or however you want).
Inside your new keyword add this code (my code has package name writeToExcel and keyword name WriteExcel, if you change yours then you need to modify my code):

package writeToExcel



import org.apache.poi.xssf.usermodel.XSSFSheet;

import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import com.kms.katalon.core.annotation.Keyword

public class WriteExcel {


def void writeToExcel(int iRow, int iCell, String iText ){

FileInputStream file = new FileInputStream (new File(“C:\\YOUR_LOCATION_OFFILE\\FILE_NAME.xlsx”))

XSSFWorkbook workbook = new XSSFWorkbook(file);

XSSFSheet sheet = workbook.getSheet(“YOUR_SHEET_NAME”)

//Write data to excel’

Row oRow;

oRow = sheet.getRow(iRow);

if(oRow == null){


oRow = sheet.getRow(iRow);


Cell oCell;

oCell = oRow.getCell(iCell - 1);

if(oCell == null ){

oRow.createCell(iCell - 1);

oCell = oRow.getCell(iCell - 1);



FileOutputStream outFile =new FileOutputStream(new File(“C:\\YOUR_LOCATION_OFFILE\\FILE_NAME.xlsx”));





You call it like this:

CustomKeywords.‘writeToExcel.WriteExcel.writeToExcel’(your_Row, your_cell, ‘your_link’)

Remember to close your EXCEL file before you run your script or it will be read-only and you want be able to write.

1 Like

And, to get the URL, you can use getUrl() from

1 Like

Thank you all ! it worked !