Can anyone help me to delete the temporary files generated during the web driver test runs? i am using selenium web driver 1.25 and IE 7.Implementing my test in java.
Asked
Active
Viewed 1.1k times
2 Answers
6
Be sure you call
driver.quit();
instead of
driver.close();
close() will not delete temporary files

Pavan Gupta
- 17,663
- 4
- 22
- 29
3
The temporary files are deleted automatically once you had used driver.quit() in the latest versions of Webdriver. Can't be sure. Is it 1.25 or 2.25 ?

Harshavardhan Konakanchi
- 4,238
- 6
- 36
- 54
-
Thats fine. though, i just want to explicitly do it in the finally block. Can you please assist me to achieve this? – Karthikeyan Mar 06 '13 at 07:18
-
@Karthikeyan You need to write driver.quit() in finally then – Harshavardhan Konakanchi Mar 06 '13 at 18:10
-
Automation_User: :P i don't what my browser to be closed, does it work for driver.close? – Karthikeyan Mar 07 '13 at 05:03
-
1@Karthikeyan It doen't work for driver.close(). It works only for driver.quit() – Harshavardhan Konakanchi Mar 07 '13 at 06:31
-
2They really are not. At least not until recently. In older releases, larger files are not deleted with quit(). It was a huge pain in the rear building a Java FX browser for automating all forms of ingestion requiring framework interaction, logins and etc. to have it fail due to a Byte Decoder leak (Oracle fix March 2017) and issues with frameworks when viewstates are missing images and things. Recently, it appears that this is working better. I still recommend using a deleteOnExit hook and specifying a directory for temp files in your profiles. – Andrew Scott Evans Sep 20 '16 at 18:45