6

With latest chromedriver.exe running into out of disk space issues as chromedriver is not deleting the folder named scoped_* at the end of the execution. It occupying almost 40 GB of space for 1000 tests.

I tried with both 2.28 and 2.29 versions of chromedriver. I am exiting the driver properly with driver.close() and driver.Quit() too. Any help?

  • I am having the same problem. It started when Google Chrome auto updated from version 56.0.2924.87 to 57.0.2987.133. I have no idea how to fix it. Things were working fine for months before the Chrome update. I updated to the latest ChromeDriver 2.29.461591, but that made no difference. – Lee Jensen Apr 8 '17 at 6:28
  • I have the same problem. If you have an idea to resolve it, I take it ^^ – Alenguard Apr 24 '17 at 12:40
  • Same problem here. I hope there will be a permanent solution soon... – Rene Willems May 11 '17 at 7:58
3

I have seen the same thing, our box that runs our automation has been running out of space. We found out that Chrome was the culprit. I don't have the answer to solve the root problem, but I have created a batch script that I have scheduled to run daily on windows machine that cleans up all the temporary folders. To create a batch file just open notepad, copy and paste the below commands into the text area and save it with the extension _____.bat at that point you should be able to setup a scheduled task through Windows Task Scheduler to run that batch file as often as you would like.

@echo off
cd %temp%
for /d %%D in (*) do rd /s /q "%%D"
del /f /q *

Source for batch script

  • we used same workaround in our project. written a .bat file to remove all folders and cache made by chrome with sort of above code, running them after the script execution seems to solve our problem. – Prasad_Joshi Jan 15 at 10:11
0

I wrote PowerShell script that clears out those temp folders and kills all browsers/webdrivers that were left running.

# Chrome - Browser
kill -processname chrome -ErrorAction SilentlyContinue 
# Chrome - WebDriver
kill -processname chromedriver -ErrorAction SilentlyContinue

# Firefox - Browser
kill -processname firefox -ErrorAction SilentlyContinue
# Firefox - WebDriver
kill -processname geckodriver -ErrorAction SilentlyContinue

# Internet Explorer - Browser
kill -processname iexplore -ErrorAction SilentlyContinue
# Internet Explorer - WebDriver
kill -processname IEDriverServer -ErrorAction SilentlyContinue

# Edge - Browser Pt.1
kill -processname MicrosoftEdge -ErrorAction SilentlyContinue
# Edge - Browser Pt.2
kill -processname MicrosoftEdgeCP -ErrorAction SilentlyContinue
# Edge - WebDriver
kill -processname MicrosoftWebDriver -ErrorAction SilentlyContinue

# Clear Chrome's Temp files
$path=$env:LOCALAPPDATA + "\Temp\scoped_dir*"
Remove-Item -Recurse -Force $path
0

You saw it right. When you run the Selenium/ChromeDriver based tests everytime a scoped_dir* is created while launching Chrome as follows:

[1547372435.413][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-extensions --disable-extensions-except="C:\Users\ATECHM~1\AppData\Local\Temp\scoped_dir4616_4705\internal" --disable-hang-monitor --disable-infobars --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=0 --start-maximized --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\ATECHM~1\AppData\Local\Temp\scoped_dir4616_1359" data:,

This scoped_dir* is required to pass the default/mandatory/configured arguments to initiate Chrome Browser. As an example:

"chrome": {
      "chromedriverVersion": "2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387)",
      "userDataDir": "C:\\Users\\ATECHM~1\\AppData\\Local\\Temp\\scoped_dir4616_1359"
   }

But on successfull invocation of driver.quit() i.e. clean exit this temporary folder should get deleted by the ChromeDriver.

As per ChromeDriver does not delete the profile & scoped_dir* folders after test exits this issue was reproducible with ChromeDriver v2.28 and Browser: Chrome 57.x where @johnchen@chromium.org mentioned:

This appears to be a race condition between ChromeDriver and Chrome. ChromeDriver creates these temp directories for use by Chrome, and at the end ChromeDriver tries to delete those directories. ChromeDriver waits for the main Chrome process to terminate before doing the deletion, but some Chrome child processes might still be running and holding on to those directories, causing the deletion to fail. Currently ChromeDriver doesn't retry the deletion. Adding some retries might be the easiest fix.

This commit Chromedriver - Retry deleting temp dir when needed added the retry logic while cleaning up these directories incase ChromeDriver fails to delete temporary directories while exiting, causing wasted disk space. This fix was part of ChromeDriver 2.30.

Incase you are still seeing scoped_dir* (incase of parallel tests) you can store the userDataDir from Returned Capabilities and delete that folder. This cleans up the scoped_dir folder for that specific instance and helps when running parallel tests.

protected by Community May 11 '17 at 11:14

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.