Search code examples
seleniumselenium-webdriverselenium-gridselenium-grid2

Selenium Grid - For Chrome browser when selenium node is run as a Windows service, I get InitSession unknown error: unable to discover open pages


I am a Selenium newbee. In fact I am covering for another automation tester.

I am trying to setup Selenium Grid, I have successfully setup Hub and node. When I run Selenium node as a Windows Service, for chrome browser I get following error.

[0.535][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-logging --ignore-certificate-errors --load-extension="C:\Windows\TEMP\scoped_dir1396_19904\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12964 --safebrowsing-disable-auto-update --test-type --use-mock-keychain --user-data-dir="C:\Windows\TEMP\scoped_dir1396_21178" data:, [60.676][INFO]: RESPONSE InitSession unknown error: unable to discover open pages

When I run node as a java program in command line (note - without windows service) it works fine.

Service is running as system user and I want to run the service as system user so that browsers don't show up when I remote login to the machine. I have also tried it using a different admin account, the result is the same.

These are the versions I am using

Selenium 2.53.1 Firefox version 45.2.0 Chrome Version 52.0.2743.82 (Chrome driver 2.22)

These are the commands I run to complete the setup. Note, I am using NSSM to setup Windows Services.

I am setting up node and hub on the same machine for the initial setup.

C:\Selenium\nssm-2.24\win32\nssm.exe install GridHub java -jar C:\Selenium\selenium-server-standalone-2.53.1.jar -role hub

C:\Selenium\nssm-2.24\win32\nssm.exe start GridHub

C:\Selenium\nssm-2.24\win32\nssm.exe stop GridNode

C:\Selenium\nssm-2.24\win32\nssm.exe remove GridNode confirm

C:\Selenium\nssm-2.24\win32\nssm.exe install GridNode java -Dwebdriver.chrome.driver="C:\Selenium\chromedriver-2.22\chromedriver.exe" -Dwebdriver.ie.driver="C:\Selenium\iedriver-2.53.1\IEDriverServer.exe" -jar C:\Selenium\selenium-server-standalone-2.53.1.jar -role webdriver -hub http://x.x.x.x:4444/grid/reg -Dwebdriver.chrome.logfile=C:\Selenium\chromedriver.log

C:\Selenium\nssm-2.24\win32\nssm.exe start GridNode

Any help is appreciated.

When I add no-sandbox option, it works smoothly


Solution

  • This I guess is a bug with Chrome browser itself which needs to be fixed. The no-sandbox option could just be a workaround. Please follow the below two issues which are raised around this.

    https://bugs.chromium.org/p/chromedriver/issues/detail?id=1424 https://bugs.chromium.org/p/chromium/issues/detail?id=615396