automationScript

How to create file using Java

This page has all the common code blocks to  create a file such as using java create temp filecreate a file, create a temporary file, create temporary file in a directory, Create temporary file with extension, Change last modified time, Get file size.

Now these methods may seem unimportant in the beginning but you may have to use it multiple times in your automation. Every time you want to create a screenshot and if you want to use the inbuilt TakeScreenshot in WebDriver, you will have to create a file to save the image file.

These are very important for any selenium based test automation project. 

Java create temp file

How to create temp file in directory

How to create temporary file with extension

How to change last modified time

How to get file size

Checkout the code repo

Subscribe for updates