RiseOfDeath
RiseOfDeath

Reputation: 53

Invalid --log-level value. Unable to initialize logging. Exiting... error while starting Selenium Grid Node

I have problem with Selenium Grid. Then I try to connect to node, i've got an error on node side.+

U run hub by this way:

java -jar .\selenium-server-standalone-3.141.59.jar -role hub

I run node by this way:

java -jar .\selenium-server-standalone-3.141.59.jar -role node -nodeConfig .\NodeConfig.json

NodeConfig.json:

{
  "capabilities":
      [
        {
            "browserName": "chrome",
            "platform": "WINDOWS",
            "maxInstances": 5,
        "chrome_binary":"chromedriver.exe",
            "seleniumProtocol": "WebDriver",
            "nodeName": "Local Chrome Node"
        }
      ],
    "maxSession": 5,
    "port": 5555,
    "register": true,
    "registerCycle": 5,
    "hub": "http://localhost:4444",
    "webdriver.chrome.driver":"<path to chromedriver.exe>"
    "nodeStatusCheckTimeout": 5,
    "nodePolling": 5,
    "role": "node",
    "unregisterIfStillDownAfter": 60,
    "downPollingLimit": 2,
    "debug": false,
    "servlets" : [],
    "withoutServlets": [],
    "custom": {}
}

Simplyfied Java code:

DriverService service = null;
ChromeOptions opts = new ChromeOptions();

opts.addArguments("-incognito");
opts.addArguments("--no-sandbox");      

driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), opts);

On Java side: A long stacktrace (I think it's not necessary for this problem)

On Node side:

java -jar .\selenium-server-standalone-3.141.59.jar -role node -nodeConfig .\NodeConfig.json 15:39:56.377 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358 15:39:56.513 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Launching a Selenium Grid node on port 5555 2019-06-18 15:39:56.921:INFO::main: Logging initialized @807ms to org.seleniumhq.jetty9.util.log.StdErrLog
15:39:57.200 INFO [WebDriverServlet.] - Initialising WebDriverServlet 15:39:57.292 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 5555 15:39:57.293 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub 15:39:57.456 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5 ms. 15:39:57.955 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://localhost:4444/grid/register 15:39:58.106 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use 15:40:06.931 INFO [ActiveSessionFactory.apply] - Capabilities are: { "browserName": "chrome", "goog:chromeOptions": {
"args": [
"-incognito",
"--no-sandbox"
], "extensions": [
],
"binary": "chromedriver.exe" } } 15:40:06.933 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService) Starting ChromeDriver 75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770@{#1003}) on port 21040 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. Starting ChromeDriver 75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770@{#1003}) on port 9515 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. Invalid --log-level value. Unable to initialize logging. Exiting...

On Hub side:

java -jar .\selenium-server-standalone-3.141.59.jar -role hub
15:39:50.884 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358 15:39:51.000 INFO [GridLauncherV3.lambda$buildLaunchers$5] - Launching Selenium Grid hub on port 4444 2019-06-18 15:39:51.425:INFO::main: Logging initialized @805ms to org.seleniumhq.jetty9.util.log.StdErrLog 15:39:51.831 INFO [Hub.start] - Selenium Grid hub is up and running 15:39:51.832 INFO [Hub.start] - Nodes should register to http://%My IP%:4444/grid/register/ 15:39:51.832 INFO [Hub.start] - Clients should connect to http://%My IP%:4444/wd/hub 15:39:58.105 INFO [DefaultGridRegistry.add] - Registered a node http://:5555
15:40:06.623 INFO [RequestHandler.process] - Got a request to create a new session: Capabilities {browserName: chrome, goog:chromeOptions: {args: [-incognito, --no-sandbox], extensions: []}} 15:40:06.632 INFO [TestSlot.getNewSession] - Trying to create a new session on test slot {chrome_binary=chromedriver.exe, nodeName=Local Chrome Node, server:CONFIG_UUID=186192e2-e951-4cef-b527-291aa9c0e2f5, seleniumProtocol=WebDriver, webdriver.chrome.driver=/chromedriver.exe, browserName=chrome, maxInstances=1, platformName=WINDOWS, version=75, platform=WINDOWS}

So, how to sole this problem and configure logs on node side (I'd like to made it via .json file)

Upvotes: 1

Views: 5320

Answers (2)

Wu Yongzheng
Wu Yongzheng

Reputation: 1707

I just came across this error and fixed it. The "Invalid --log-level value" error is caused by using ChromeDriver as Chrome. Selenium runs ChromeDriver, then ChromeDriver runs Chrome. Chrome recognise "--log-level=0", but not ChromeDriver.

What's happening here is that you try to use ChromeDriver to run ChromeDriver. The reason can be specifying ChromeDriver's path as Chrome. E.g. symbolic link chromedriver as chrome, or ChromeOptions.setBinary(".../chromedriver")

Upvotes: 1

undetected Selenium
undetected Selenium

Reputation: 193098

Analyzing the NodeConfig.json and both Selenium Grid Hub and Selenium Grid Hub logs, there seems to be an issue with the  --no-sandbox argument.


Sandbox

The sandbox library which allows the creation of sandboxed processes that can execute within a very restrictive environment cannot write to disk. Chromium renderers are sandboxed processes.


Solution

Some more information about Selenium client, ChromeDriver / Chrome version would have helped us to debug the issue in a better way. However as you are using Chrome in regular mode (non headless), you may drop the argument --no-sandbox.


tl; dr

Unable to Create Driver Instance for chrome in ubuntu

Upvotes: 0

Related Questions