4

I am using Selenium 2.35.0 to access web pages in a loop by calling chromedriver_win32_2.3/chromedriver.exe. Sometimes an exception would happen (Time out etc.) and something would create a lot of scoped_dir**_ folders and gradually filling up the disk space.

The strange thing is even if I reboot the computer, the writing continues after restart. The only way to stop this is to delete the user account.

I looked at the running processes and could not find anything unusual.
Any explanation on why this happens?

Nakilon
  • 34,866
  • 14
  • 107
  • 142
user2720403
  • 71
  • 1
  • 1
  • 2
  • 1
    There was similar issue for firefox here : http://stackoverflow.com/questions/6787095/how-to-stop-selenium-from-creating-temporary-firefox-profiles-using-web-driver . – Madusudanan Sep 09 '13 at 08:26
  • Madusudanan: I looked through the link you provided, the problem seems to be different. A potentially useful part is to delete the temporary files in case the WebDriver cannot start. However, it does work in my case. – user2720403 Sep 23 '13 at 16:14
  • The scoped dir is the counterpart of firefox's anonymous webdriver profile folders.They are created by chromedriver,the issue seems to be still open, See-> https://code.google.com/p/selenium/issues/detail?id=1934. I have faced this similar issue and as of now I am clearing the temp files manually.Perhaps you could try not closing your browser and use clear cookies functionality that comes with webdriver for each browser.Spawning a new browser creates many temp folders like that. – Madusudanan Sep 24 '13 at 07:04
  • I have the same problem on one of my selenium grid machines. I updated the chromedriver.exe to version 2.4 and now the scoped_dir** files/folders seem to get deleted after both successfull and failed tests. – derhansen Oct 29 '13 at 10:00

2 Answers2

3

I came across this question trying to solve my own problem. This is what worked for me. I am using instance of my ScrapeTest class. in my class definition I have the following destructor,

def __del__(self):
    """ close webdriver
    """
    self.driver.close()
    self.driver.quit()

Even though the destructor get called after each run, it was not working until I use del to delete my scraper instance explicitly.

hashmuke
  • 3,075
  • 2
  • 18
  • 29
3

This is a bug in chromedriver that has been fixed and resurfaced several times. It will be fixed again in Chromedriver 2.30 which hasn't been released yet.

carlin.scott
  • 6,214
  • 3
  • 30
  • 35