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:,
scoped_dir* is required to pass the default/mandatory/configured arguments to initiate Chrome Browser. As an example:
"chromedriverVersion": "2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387)",
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 @email@example.com 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.