skip to Main Content

Filehandler function

This function is used to handle file processing like watching file in a folder, copy and paste a particular extension file, delete a file and verify text from the file.

Select SET command from the Action drop-down, leave the Screen name blank, write a variable name in the Element key, click on form, you will see form will open, select function from the drop down then select FILEHANDLER function and select key value from cmd field. The file handler function shown below:

Select “watch” as a key value in cmd field.

After completing this step, the test step will look as below:

This function perform four actions as given below:

  • Watch
  • Copy
  • Delete
  • Verifytext


Watch is used to find out the exact path of a file by looking into a folder using file extension.

Syntax: ${__filehandle(cmd=action name,folder=folder path,extension=extension type,prefix=file name prefix, timeout=time taken to search the file)}

where, cmd denotes the command user wants to perform like the watch. folder denotes which folder is to be watched extension is the file extension to watch in a particular folder example txt, xls, pdf, etc. prefix is the filename prefix if the user wants to give timeout denotes time taken to search the file.

Note: prefix and time out is an optional parameter and if timeout is not given explicitly then default timeout is 5 minutes.

Example: ${__filehandle(cmd=watch,folder=C:\BeatBlip\DemoTwo\sourcelocation,extension=txt)}

In the above example spath is the name of a variable which will store the complete path of the file.


Copy is used to copy the file from source location to destination folder.

Example: ${__filehandle(cmd=copy,source=C:\BeatBlip\Demo1\file1.txt,destination=C:\BeatBlip\Demo2)}

In the above snapshot, output variable will be set with true if file is copied successfully.


Delete is used to delete a particular file.

Example: ${__filehandle(cmd=delete,file= C:\BeatBlip\Demo1\file1.txt )}

For verifytext:

verifytext is used to verify if the given text is present in the file or not.

Example: ${__filehandle(cmd=verifytext,file= C:\BeatBlip\Demo1\file1.txt ,text=Hello)}

Back To Top