Skip to content

Commit cc9abcb

Browse files
andyphillips404glibas
authored andcommitted
Update to Browser to Delete .png files being left in java tmp directory (#26)
Update Browser.java cleanup temp files
1 parent d7b42ef commit cc9abcb

File tree

1 file changed

+7
-1
lines changed
  • src/main/java/com/assertthat/selenium_shutterbug/utils/web

1 file changed

+7
-1
lines changed

src/main/java/com/assertthat/selenium_shutterbug/utils/web/Browser.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ public BufferedImage takeScreenshot() {
6969
return ImageIO.read(srcFile);
7070
} catch (IOException e) {
7171
throw new UnableTakeSnapshotException(e);
72-
}
72+
} finally {
73+
// add this to clean up leaving this file in the temporary directory forever...
74+
if (srcFile.exists()) {
75+
srcFile.delete();
76+
}
77+
}
78+
7379
}
7480

7581
public BufferedImage takeScreenshotEntirePage() {

0 commit comments

Comments
 (0)