Chromedriver is not deleting the folder named scoped_* at the end of the execution.
Chromedriver not deleting scoped* dir in temp folder after test is complete
The above solution is not working for me, I need a python solution.
My version of google chrome is: 99.0.4844.74 64 bits and I tried chromedriver 99.0.4844.51 and ChromeDriver 99.0.4844.35
Also tried this code at the end of every script, after driver.close() and driver.quit():
try:
for f in glob.glob(r"C:\Windows\Temp\scoped_dir*"):
shutil.rmtree(f)
except Exception as e:
print(e)
output:
[WinError 5] Access is denied: 'C:\Windows\Temp\scoped_dir130892_1670710986\BrowserMetrics\BrowserMetrics-62347334-8E820.pma'
Also tried to run a batch file with the following code:
@echo off
Taskkill /IM chromedriver.exe /F
Taskkill /IM chrome.exe /F
cd /D %Temp%
for /d %%D in (scoped_dir*) do rd /s /q "%%D"
del /f /q *
output:
SUCCESS: The process "chrome.exe" with PID 406028 has been terminated.
but it doesn't delete the folders.