0

Using encoder (Link), To record video which is playing on screen for Selenium automation script.

 ScreenCaptureJob scj = new ScreenCaptureJob();
 scj.OutputScreenCaptureFileName = "XXX.avi";
 scj.Start();

It is required to delete existing file, before to write .avi file on existing name.

Is it possible to replace existing file Or override it ?

Ishita Shah
  • 3,955
  • 2
  • 27
  • 51

2 Answers2

1

You can try deletion of file before saving it:

try {
    Files.deleteIfExists(Paths.get("PATH TO FILE\"XXX.avi"));
} catch (IOException e) {
    e.printStackTrace();
}
0

With reference to C# utility, Implemented as:

if (File.Exists(path))
{
File.Delete(path);
}
Ishita Shah
  • 3,955
  • 2
  • 27
  • 51