使用selenium 3和FirefoxProfile()进行Firefox内存泄漏

时间:2017-09-30 13:54:44

标签: selenium-webdriver gecko geckodriver

我一直在努力解决firefox 56.0中的内存泄漏与selenium 3.5.3和gecko驱动程序今晚找到了一个我无法解释的解决方案:如果我不使用Firefox配置文件,问题就会消失 - 不幸的是,这违背了使用firefox时的所有建议。

任何人都可以解释为什么内存泄漏会消失以及我如何使用配置文件而不会遭受内存泄漏?

我的代码:

DesiredCapabilities capabilities = DesiredCapabilities.firefox();

capabilities.setCapability("marionette", true);

FirefoxProfile profile = new FirefoxProfile();

// Work around for FireFox not closing, fix comes from here: https://github.com/mozilla/geckodriver/issues/517
profile.setPreference("browser.tabs.remote.autostart", false);
profile.setPreference("browser.tabs.remote.autostart.1", false);
profile.setPreference("browser.tabs.remote.autostart.2", false);
profile.setPreference("browser.tabs.remote.force-enable", false);

// If I comment out this memory leak goes away
capabilities.setCapability(FirefoxDriver.PROFILE, profile);

WebDriver driver = new FirefoxDriver(capabilities);

0 个答案:

没有答案