Avi Kessler
Avi Kessler

Reputation: 23

Selenium grid - node configuration file for Firefox not reading moz:firefoxOptions

I have setup my selenium grid (currently 1 hub and 1 node). The hub is working fine but for my node I setup the below configuration file (nodeconfig.json) I wanted to start the firefox in headless mode but it looks like the "moz:firefoxOptions" configuration did not catch up. I tried setting the "moz:firefoxOptions" in a variety of location in side the json file without any luck :( .

I are using : windows server 2016 64bit , selenium-server-standalone 3.9.1 geckodriver v0.19.1 firefox v59.0

we are running the node using the following command : java -Dwebdriver.gecko.driver="geckodriver.exe" -Dwebdriver.chrome.driver="chromedriver.exe" -jar selenium-server-standalone-3.9.1.jar -role node -nodeConfig nodeconfig.json I can tell that the configuration file was read as I can see it in the selenium grid console.

nodeconfig.json file:


    {
        "capabilities": [
            {
            "browserName": "firefox",
            "maxInstances": 5,
            "seleniumProtocol": "WebDriver",
            "alwaysMatch": {
            "moz:firefoxOptions": {
                "args": [
                    "-headless"
                    ]
                }
            }
        },
        {
            "browserName": "chrome",
            "maxInstances": 5,
            "seleniumProtocol": "WebDriver"
        }
        ],
        "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
        "maxSession": 5,
        "port": 5555,
        "register": true,
        "registerCycle": 5000,
        "hub": "http://localhost:4444",
        "nodeStatusCheckTimeout": 5000,
        "nodePolling": 5000,
        "role": "node",
        "unregisterIfStillDownAfter": 60000,
        "downPollingLimit": 2,
        "debug": false,
        "servlets": [],
        "withoutServlets": [],
        "custom": {}
    }

In addition from the logs I can tell that the argument is not added.

The relevant line is :

1520854660258 mozrunner::runner INFO Running command: "C:\Program Files\Mozilla Firefox\firefox.exe" "-marionette" "-profile" "C:\Users\avi\AppData\Local\Temp\rust_mozprofile.03tQm3hduVDR"

Upvotes: 0

Views: 1274

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193308

As per the documentation the argument is --headless not -headless. So possibly you have to change to :

"moz:firefoxOptions": {
"args": [
    "--headless"
    ]
}

You can find a detailed discussion in How to make firefox headless programatically in Selenium with python?

Upvotes: 0

Related Questions