Java – selenium: http: / / localhost: 4444 / WD / hub returns NullPointerException. What did I do wrong

Given: try using this code to use remotewebdriver in c#

var url = new Uri("http://localhost:4444/wd/hub");
var wd = new RemoteWebDriver(url,DesiredCapabilities.Chrome());

The new remotewebdriver code above will not respond until it times out

More details

I have started my hub to selenium server with these parameters:

-jar "C:\SomeFolder\selenium-server-standalone-3.0.1.jar" -port 4444 -role hub

And registered a node with these parms

-jar "C:\SomeFolder\selenium-server-standalone-3.0.1.jar" -role node -hub http://localhost:4444/grid/register -port 9662

debugging

If I enter this URL after starting the hub, it indicates that there are registered nodes:

http://location:4444/grid/console

However, when you enter this URL after starting hub

http://localhost:4444/wd/hub

The browser display points to externalsessionkey This Java (JSON) stack trace for Java

{"status":13,"value":{"class":"java.lang.NullPointerException","stackTrace":[{"fileName":"ExternalSessionKey.java","className":"org.openqa.grid.internal.ExternalSessionKey","methodName":"fromWebDriverRequest","lineNumber":77},{"fileName":"WebDriverRequest.java","className":"org.openqa.grid.web.servlet.handler.WebDriverRequest","methodName":"extractSession","lineNumber":62},{"fileName":"RequestHandler.java","className":"org.openqa.grid.web.servlet.handler.RequestHandler","methodName":"getSession","lineNumber":231},"methodName":"process","lineNumber":118},{"fileName":"DriverServlet.java","className":"org.openqa.grid.web.servlet.DriverServlet","lineNumber":83},"methodName":"doGet","lineNumber":61},{"fileName":"HttpServlet.java","className":"javax.servlet.http.HttpServlet","methodName":"service","lineNumber":687},"lineNumber":790},{"fileName":"ServletHolder.java","className":"org.seleniumhq.jetty9.servlet.ServletHolder","methodName":"handle","lineNumber":808},{"fileName":"ServletHandler.java","className":"org.seleniumhq.jetty9.servlet.ServletHandler","methodName":"doHandle","lineNumber":587},{"fileName":"SessionHandler.java","className":"org.seleniumhq.jetty9.server.session.SessionHandler","lineNumber":221},{"fileName":"ContextHandler.java","className":"org.seleniumhq.jetty9.server.handler.ContextHandler","lineNumber":1127},"methodName":"doScope","lineNumber":515},"lineNumber":185},"lineNumber":1061},{"fileName":"ScopedHandler.java","className":"org.seleniumhq.jetty9.server.handler.ScopedHandler","lineNumber":141},{"fileName":"HandlerWrapper.java","className":"org.seleniumhq.jetty9.server.handler.HandlerWrapper","lineNumber":97},{"fileName":"Server.java","className":"org.seleniumhq.jetty9.server.Server","lineNumber":499},{"fileName":"HttpChannel.java","className":"org.seleniumhq.jetty9.server.HttpChannel","lineNumber":310},{"fileName":"httpconnection.java","className":"org.seleniumhq.jetty9.server.httpconnection","methodName":"onFillable","lineNumber":257},{"fileName":"AbstractConnection.java","className":"org.seleniumhq.jetty9.io.AbstractConnection$2","methodName":"run","lineNumber":540},{"fileName":"QueuedThreadPool.java","className":"org.seleniumhq.jetty9.util.thread.QueuedThreadPool","methodName":"runJob","lineNumber":635},"className":"org.seleniumhq.jetty9.util.thread.QueuedThreadPool$3","lineNumber":555},{"className":"java.lang.Thread","lineNumber":-1}]}}

Anyone can explain stack trace to me and how to make it work?

thank you!

Solution

There's nothing wrong with your ending

The URL http: / / localhost: 4444 / WD / hub is designed so that it expects payload to work with you Since you did not provide the required payload, you will see a NullPointerException

This URL should not be opened in a browser It means that the appropriate payload is consumed through HTTP operation, which complies with selenium W3C spec

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>