go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5.42k stars 356 forks source link

userdatadir so bigger #1102

Closed victory-zz closed 3 months ago

victory-zz commented 3 months ago

After running for a long time, the user data file will become larger. How to delete this file after browser.stop using os.removel? Regardless of whether os. chmod ("path", 0777) is executed or not, it will still report "assessment is denied"; When using exec to delete a folder, it cannot be deleted, and cmd. run() does not report an error

use os.removeall: err = os.chmod(userdatafile, 0777) if err != nil { log.Info("error infor:" + err.Error()) } err = os.RemoveAll(userdatafile) if err != nil { log.Info("error infor:" + err.Error()) }

use exec: //cmd := exec.Command("cmd", "/C", "rmdir", "/s", "/q", userdatafile) //err = cmd.Run() //if err != nil { // log.Info("error infor:" + err.Error()) //}

github-actions[bot] commented 3 months ago

Please add a valid Rod Version: v0.0.0 to your issue. Current version is v0.116.2

generated by check-issue

ysmood commented 3 months ago

Restart your OS, or kill all chrome related processes, or use https://go-rod.github.io/#/custom-launch?id=remotely-manage-the-launcher