Is it Firefox or Geckodriver, which creates “rust_mozprofile” directory

拟墨画扇 提交于 2019-12-17 07:54:12

问题


Whenever we invoke Firefox, under '/tmp' directory rust_mozprofile directories are getting created. As Firefox internally calls Geckodriver we are not sure whether Firefox or Geckodriver is creating rust_mozprofile directory.

I do want to know whether Geckodriver or Firefox because, my '/tmp' directory is having less memory.

So the question is I really want to modify the path of creating directories for rust_mozprofile.

I am using below technologies,

  • Selenium - 3.3.0
  • Firefox - 52.2.0
  • Geckodriver - 13

Please give us some suggestion, if there is any.


回答1:


If you have a closer look at the geckodriver v0.18.0 logs closely you will observe the very first occurrence of rust_mozprofile occurs in the following line:

1504762617094   Marionette  CONFIG  Matched capabilities: {"browserName":"firefox","browserVersion":"56.0","platformName":"windows_nt","platformVersion":"6.2","pageLoadStrategy":"normal","acceptInsecureCerts":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"rotatable":false,"specificationLevel":0,"moz:processID":5848,"moz:profile":"C:\\Users\\AtechM_03\\AppData\\Local\\Temp\\rust_mozprofile.OfFuR9ogm33d","moz:accessibilityChecks":false,"moz:headless":false}

This log clearly indicates that Marionette is being configured with "moz:profile":"C:\\Users\\AtechM_03\\AppData\\Local\\Temp\\rust_mozprofile.OfFuR9ogm33d" and this configuration is done by the WebDriver instance i.e. the geckodriver.

It's the GeckoDriver which internally configures the Marionette which in-turn initiates the Mozilla Firefox Browser.

IMO, this workflow is in practice since we migrated from the Legacy Firefox to Marionette based Firefox. Hence the same must be the case with Geckodriver - 13 as well.

Update:

GeckoDriver as an application/exe file:




回答2:


I had a similar problem and I solved it by changing the Environment settings in Windows. Meaning that I changed the directory for the TMP and TEMP files, and after a reboot, the rust_mozprofile folder was generated where I wanted it.

This is the source I used: https://www.toolsqa.com/selenium-webdriver/how-to-use-geckodriver/ Specifically the "Set property in Environment Variables:-" section.

Sadly this will effect all Software that saves files to those folders. (In my case that is what I wanted though.) If there is a way to make only the rust_mozprofile folder be created in a specific directory through the program, I would love to learn more.




回答3:


You can set the location with the TMPDIR envvar. It's also useful to set both TMP and TEMP for other programs.




回答4:


A solution is to use driver.quit() this closes all browsers and takes care of the profiles

Another solution is to add a custom profile

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


来源:https://stackoverflow.com/questions/46088442/is-it-firefox-or-geckodriver-which-creates-rust-mozprofile-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!