3

I am using Selenium Python bindings with geckodriver. After each browser session rust_mozprofile directories are created in my Windows 7 Temp directory. The houndreds of newly created directories can quickly add up to 5 - 6 GB.

I looked for a solution, but I haven't found anything so far. I can manually delete these directories, but this is not optimal. Is there a way to solve this problem programmatically in Selenium?

This is not a duplicate, here is why:

I checked the answer here but it does not solve my problem. I would like to find a way to create a separate Firefox Profile and use it in Selenium Test Execution or any other way to solve this problem programmatically in Selenium if possible.

Joe T. Boka
  • 6,554
  • 6
  • 29
  • 48
  • Possible duplicate of [Is it Firefox or Geckodriver, which creates "rust\_mozprofile" directory](https://stackoverflow.com/questions/46088442/is-it-firefox-or-geckodriver-which-creates-rust-mozprofile-directory) – undetected Selenium Apr 08 '18 at 14:49

1 Answers1

1

A solution is to use driver.quit() instead of driver.close()

As explained here

Another solution is to add a custom profile

fp = webdriver.FirefoxProfile('specify location to profile .default') driver = webdriver.Firefox(firefox_profile=fp)

K. Abhulimen
  • 137
  • 1
  • 13
  • 1
    I'm using FirefoxProfile but it still copy that profile folder to /tmp/rust_mozprofile... I checked geckodriver.log , I saw this : Running command: "/usr/bin/firefox" "-marionette" "-profile" "/tmp/rust_mozprofile.ZeoXTluZ5ZCT" How can I stop creating profile folder, or at least move it to another folder. Because I created many Xvfb process at the same time while boot partition is small then it make full hard disk – boygiandi Aug 28 '18 at 02:12
  • This line `fp = webdriver.FirefoxProfile('specify location to profile .default')` will copy whatever profile you have at that location, paste it to `/tmp/rust_mozprofileasdf123` and then driver will use this copied version of profile. – Monty Chain Dec 17 '19 at 09:00