0

I am receiving the following error when trying to launch my automation tests using selenium grid.

I have the hub running after launching this command.

When I browse http://10.1.27.27:4441/grid/register

I receive this error message:

HTTP ERROR 500
Problem accessing /grid/register. Reason:
Server Error
Caused by:
java.lang.IllegalStateException: Not a JSON Object: null
at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:90)
at org.openqa.grid.web.servlet.RegistrationServlet.process(RegistrationServlet.java:84)
at org.openqa.grid.web.servlet.RegistrationServlet.doGet(RegistrationServlet.jav

Command to start the hub

C:\seleniumserver\java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4441
C:\seleniumserver\java -jar selenium-server-standalone-3.4.0.jar -role wd -hub http://localhost:4441/grid/register

Code

var capabilities = DesiredCapabilities.Chrome();
capabilities.Platform = Platform.CurrentPlatform;
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4441/wd/hub"), capabilities);

Error message received

at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities)
at Boden.Automation.Workflow.BodenMobileNavigation..ctor() in C:\Projects\UAT Automation\Dev\SourceCode\test.cs:line 43
at test..ctor() in C:\Projects\UAT Automation\Dev\SourceCode\test.cs:line 21

Log

Log

Log 2

node log

Update

Here are my actions. Open command prompt (as administrator), navigate to the selenium jar folder and execute this command

java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4441

The output from this command is here:

C:\SeleniumGrid>java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4441
14:40:34.811 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
14:40:34.811 INFO - Launching Selenium Grid hub
2017-08-03 14:40:35.252:INFO::main: Logging initialized @603ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:40:35.262 INFO - Will listen on 4441
2017-08-03 14:40:35.299:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-08-03 14:40:35.322:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
2017-08-03 14:40:35.322:INFO:osjs.session:main: No SessionScavenger set, using defaults
2017-08-03 14:40:35.324:INFO:osjs.session:main: Scavenging every 600000ms
2017-08-03 14:40:35.329:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@154b04f{/,null,AVAILABLE}
2017-08-03 14:40:35.341:INFO:osjs.AbstractConnector:main: Started ServerConnector@13af739{HTTP/1.1,[http/1.1]}{0.0.0.0:4441}
2017-08-03 14:40:35.341:INFO:osjs.Server:main: Started @692ms
14:40:35.342 INFO - Nodes should register to 
http://10.1.27.27:4441/grid/register/
14:40:35.342 INFO - Selenium Grid hub is up and running

Then, I open a new command prompt (as administrator) and execute the following command in the selenium folder

java -jar selenium-server-standalone-3.4.0.jar -role wd -hub http://localhost:4441/grid/register

The output from this command is here:

C:\SeleniumGrid>java -jar selenium-server-standalone-3.4.0.jar -role wd -hub http://localhost:4441/grid/register
14:41:19.175 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
14:41:19.175 INFO - Launching a Selenium Grid node
2017-08-03 14:41:19.516:INFO::main: Logging initialized @505ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:41:19.563 INFO - Driver class not found: com.opera.core.systems.OperaDriver
14:41:19.563 INFO - Driver provider com.opera.core.systems.OperaDriver 
registration is skipped:Unable to create new instances on this machine.
14:41:19.564 INFO - Driver class not found: com.opera.core.systems.OperaDriver
14:41:19.564 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
14:41:19.565 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped: registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN8_1
2017-08-03 14:41:19.592:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-08-03 14:41:19.613:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@10f1111{/,null,AVAILABLE}
2017-08-03 14:41:19.625:INFO:osjs.AbstractConnector:main: Started ServerConnector@23e5ee{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
2017-08-03 14:41:19.626:INFO:osjs.Server:main: Started @615ms
14:41:19.626 INFO - Selenium Grid node is up and ready to register to the hub
14:41:19.636 INFO - Starting auto registration thread. Will try to register every 5000 ms.
14:41:19.636 INFO - Registering the node to the hub:http://localhost:4441/grid/register
14:41:19.675 INFO - The node is registered to the hub and ready to use

C# error (from running it within visual studio)

at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities) at ....ctor() in C:\Projects\UAT Automation\Dev\SourceCode...cs:line 38 at ....ctor() in C:\Projects\UAT Automation\Dev\SourceCode...cs:line 21

This is the error I receive

visual studio and command prompts screen shot

user7558986
  • 65
  • 2
  • 8
  • Can you please share the logs from the node machine when this error happens ? – Krishnan Mahadevan Aug 03 '17 at 12:14
  • im not sure where the logs are located? – user7558986 Aug 03 '17 at 12:32
  • You should be able to see the logs in the same command prompt wherein you ran `java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://localhost:4441/grid/register` – Krishnan Mahadevan Aug 03 '17 at 12:33
  • I've updated my question with the log – user7558986 Aug 03 '17 at 12:39
  • You have shared the logs from the command prompt wherein you started the `hub` and I was asking about the command prompt wherein you were running your `node`. Please share the node logs as well along with the complete command you are using to start your hub and node. Your Hub logs indicate there was a problem when the node was trying to register itself. – Krishnan Mahadevan Aug 03 '17 at 12:41
  • sorry, have uploaded it just now. – user7558986 Aug 03 '17 at 12:52
  • not sure what the opera driver reference in the logs is..? I can only see IE, firefox and chrome icons in the grid looking at http://localhost:4441/grid/console?config=true&configDebug=true – user7558986 Aug 03 '17 at 13:08
  • Ok I am not sure if you are getting what I am asking for. Please do the following : 1. Start Hub (share the complete command). 2. Start Node (share the complete command).3. See if there are any errors in the command prompt which starts the hub (If yes, share those logs separately). 4. Run CSharp test. If it errors out, extract logs from the command prompt wherein node is running and share that. Please donot share screenshots. Please post the actual contents of the logs so that its easy for people to read and figure out what is going on. – Krishnan Mahadevan Aug 03 '17 at 13:11
  • think that's what you want, please let me know if you need anything else to help – user7558986 Aug 03 '17 at 13:55
  • Ok you added the basic logs ( forget about the Opera driver, you can ignore that ). Now can u run your csharp test and extract out the node logs from the terminal as soon as your test errors ? – Krishnan Mahadevan Aug 03 '17 at 14:15
  • Ive added a screen shot just to clarify what I'm doing. Let me know if I'm doing something wrong – user7558986 Aug 04 '17 at 09:30
  • You have shared the exception details when your csharp code fails. At that time do you see any errors in the node logs ? That is what I have been asking from the beginning. When your CSharp Test fails, I need to see the logs from your selenium node (if there are any errors) – Krishnan Mahadevan Aug 05 '17 at 08:14
  • I stopped all the command prompts and started again. It seems that when I go to http://localhost:5555/wd/hub/static/resource/hub.html and click create new session I can see the command prompt scroll down with new information so it looks like the resource/hub is working – user7558986 Aug 07 '17 at 09:32

0 Answers0