是Firefox还是Geckodriver,它创建了“rust_mozprofile”目录

问题描述 投票:4回答:4

每当我们调用Firefox时,在'/ tmp'目录下都会创建rust_mozprofile目录。由于Firefox内部称为Geckodriver,我们不确定Firefox或Geckodriver是否正在创建rust_mozprofile目录。

我想知道Geckodriver还是Firefox,因为我的'/ tmp'目录的内存较少。

所以问题是我真的想修改为rust_mozprofile创建目录的路径。

我正在使用以下技术,

  • 硒 - 3.3.0
  • Firefox - 52.2.0
  • 壁虎司机 - 13

如果有的话,请给我们一些建议。

selenium firefox selenium-webdriver geckodriver
4个回答
3
投票

如果您仔细查看geckodriver v0.18.0日志,您将观察到rust_mozprofile第一次出现在以下行:

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}

该日志清楚地表明Marionette正在配置"moz:profile":"C:\\Users\\AtechM_03\\AppData\\Local\\Temp\\rust_mozprofile.OfFuR9ogm33d",并且这种配置由WebDriver实例即geckodriver完成。

这是GeckoDriver内部配置Marionette,反过来启动Mozilla Firefox Browser

IMO,这个工作流程在实践中,因为我们从Legacy Firefox迁移到基于MarionetteFirefox。因此,Geckodriver - 13也必须如此。

更新:

GeckoDriver作为应用程序/ exe文件:enter image description here


0
投票

我有类似的问题,我通过更改Windows中的环境设置解决了它。这意味着我更改了TMP和TEMP文件的目录,并在重新启动后生成了rust_mozprofile文件夹,我想要它。

这是我使用的源:https://www.toolsqa.com/selenium-webdriver/how-to-use-geckodriver/特别是“在环境变量中设置属性: - ”部分。

遗憾的是,这将影响将文件保存到这些文件夹的所有软件。 (在我的情况下,这就是我想要的。)如果有办法只通过程序在特定目录中创建rust_mozprofile文件夹,我希望了解更多。


0
投票

您可以使用TMPDIR envvar设置位置。为其他程序设置TMP和TEMP也很有用。


-1
投票

一个解决方案是使用driver.quit()关闭所有浏览器并处理配置文件

另一种解决方案是添加自定义配置文件

fp = webdriver.FirefoxProfile('specify location to profile .default') 
driver = webdriver.Firefox(firefox_profile=fp)
© www.soinside.com 2019 - 2024. All rights reserved.