Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium not deleting profiles on browser close

I'm running some fairly simple tests using browsermob and selenium to open firefox browsers and navigate through a random pages. Each firefox instance is supposed to be independent and none of them share any cookies or cache. On my mac osx machine, this works quite nicely. The browsers open, navigate through a bunch of pages and then close. On my windows machine, however, even after the firefox browser closes, the tmp** folders remain and, after leavin the test going on for a while, they begin to take up a lot of space. I was under the impression that each newly spawned browser would have its own profile, which it clearly does, but that it would delete the profile it made when the browser closes. Is there an explicit selenium command I'm missing to enforce this behaviour?

Additionally, I've noticed that some of the tmp folders are showing up in AppData/Local/Temp/2 and that many others are showing up in the folder where I started running the script...

like image 961
Jainathan Leung Avatar asked Jan 30 '13 19:01

Jainathan Leung


People also ask

How do I close a browser session in Selenium Webdriver?

close() closes only the current window on which Selenium is running automated tests. The WebDriver session, however, remains active. On the other hand, the driver. quit() method closes all browser windows and ends the WebDriver session.

Which Selenium method is used to delete all cookies from the web page?

We can delete cookies on all domains with Selenium. The method deleteAllCookies is used to delete all cookies from the present domain.


1 Answers

On your mac, have you looked in /var/folders/? You might find a bunch of anonymous*webdriver-profile folders a few levels down. (mine appear in /var/folders/sm/jngvd6s57ldb916b7h25d57r0000dn/T/)

Also, are you using driver.close() or driver.quit()? I thought driver.quit() cleans up the temp folder, but I could be wrong.

like image 125
jgode Avatar answered Sep 30 '22 00:09

jgode