给定:尝试使用此代码在C#中使用RemoteWebDriver.
var url = new Uri("http://localhost:4444/wd/hub"); var wd = new RemoteWebDriver(url, DesiredCapabilities.Chrome());
上面的新RemoteWebDriver代码在超时后才会响应...
更多细节
我已经使用这些参数启动了我的Hub到Selenium Server:
-jar "C:\SomeFolder\selenium-server-standalone-3.0.1.jar" -port 4444 -role hub
并使用这些parms注册了一个节点..
-jar "C:\SomeFolder\selenium-server-standalone-3.0.1.jar" -role node -hub http://localhost:4444/grid/register -port 9662
调试
如果我在启动集线器后输入此URL,则表明存在已注册的节点:
HTTP://地点:4444 /格/控制台
但是在启动Hub后输入此URL时
HTTP://本地主机:4444/WD /集线器
浏览器显示指向ExternalSessionKey.java的此java(json)堆栈跟踪
{"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},{"fileName":"RequestHandler.java","className":"org.openqa.grid.web.servlet.handler.RequestHandler","methodName":"process","lineNumber":118},{"fileName":"DriverServlet.java","className":"org.openqa.grid.web.servlet.DriverServlet","methodName":"process","lineNumber":83},{"fileName":"DriverServlet.java","className":"org.openqa.grid.web.servlet.DriverServlet","methodName":"doGet","lineNumber":61},{"fileName":"HttpServlet.java","className":"javax.servlet.http.HttpServlet","methodName":"service","lineNumber":687},{"fileName":"HttpServlet.java","className":"javax.servlet.http.HttpServlet","methodName":"service","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","methodName":"doHandle","lineNumber":221},{"fileName":"ContextHandler.java","className":"org.seleniumhq.jetty9.server.handler.ContextHandler","methodName":"doHandle","lineNumber":1127},{"fileName":"ServletHandler.java","className":"org.seleniumhq.jetty9.servlet.ServletHandler","methodName":"doScope","lineNumber":515},{"fileName":"SessionHandler.java","className":"org.seleniumhq.jetty9.server.session.SessionHandler","methodName":"doScope","lineNumber":185},{"fileName":"ContextHandler.java","className":"org.seleniumhq.jetty9.server.handler.ContextHandler","methodName":"doScope","lineNumber":1061},{"fileName":"ScopedHandler.java","className":"org.seleniumhq.jetty9.server.handler.ScopedHandler","methodName":"handle","lineNumber":141},{"fileName":"HandlerWrapper.java","className":"org.seleniumhq.jetty9.server.handler.HandlerWrapper","methodName":"handle","lineNumber":97},{"fileName":"Server.java","className":"org.seleniumhq.jetty9.server.Server","methodName":"handle","lineNumber":499},{"fileName":"HttpChannel.java","className":"org.seleniumhq.jetty9.server.HttpChannel","methodName":"handle","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},{"fileName":"QueuedThreadPool.java","className":"org.seleniumhq.jetty9.util.thread.QueuedThreadPool$3","methodName":"run","lineNumber":555},{"className":"java.lang.Thread","methodName":"run","lineNumber":-1}]}}
任何人都可以为我解释Stack Trace,以及如何使其工作?
谢谢!
你的结局没有错.
URL http://localhost:4444/wd/hub
的设计使其期望PAYLOAD与您的操作.由于您未提供所需的有效负载,因此您会看到NullPointerException.
此URL不应在浏览器中打开.它意味着通过Http操作使用符合Selenium w3c规范的适当有效负载