Search code examples
javafirefoxselenium-grid2

Multiple Selenium Grid 2 Test: how to run in Firefox with hidden windows Browser


I would like to run a Selenium Grid 2 Test with 50 parallel Instances of Firefox independent Browsers (or more). But if all these browsers windows open, it requires a lot of machine memory. For this reason I want to run the test with the hidden Firefox windows. How to run this Test with Firefox windows in Background. I tried:

DesiredCapabilities capability = new DesiredCapabilities();
capability = DesiredCapabilities.firefox();
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.tabs.loadDivertedInBackground", true);
capability.setCapability(FirefoxDriver.PROFILE, profile);

But it did not work. Can anyone help me?


Solution

  • Please consider using HTMLUnitDriver. That will make sure that no UI is launched. This is the performant and proven way of doing sanity testing.

    HtmlUnitDriver driver = new HtmlUnitDriver(DesiredCapabilities.firefox());
    driver.get("http://anysiteurl");
    driver.quit();