我们启动Selenium服务器(elgalu/docker-selenium):
require('child_process').execSync(
`docker run -d --name="selenium-tester-3" ` +
`-p 40002:24444 -p 40012:25900 --shm-size=1g ` +
`-e NOVNC=false -e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1480 -e VNC_PASSWORD=no ` +
`elgalu/selenium`
);
通过chimpy连接到它:
[chimp][session-manager] checking connection to selenium server
[11:40:53] COMMAND GET "/wd/hub/status"
[11:40:53] DATA {}
[11:40:53] RESULT {
"ready":true,"message":"Hub has capacity",
"build":{"revision":"e82be7d358","time":"2018-11-14T08:25:53","version":"3.141.59"},
"os":{"arch":"amd64","name":"Linux","version":"4.15.0-1014-gcp"},
"java":{"version":"1.8.0_191"}
}
We are trying to execute the query /wd/hub/sessions
,但出现错误500
:
[chimp][session-manager] requesting sessions from http://localhost:40002/wd/hub/sessions
[chimp][session-manager] received error Server Error [500]
[chimp][session-manager] response {
"sessionId": null,
"status": 13,
"value": {
"class": "org.openqa.grid.common.exception.GridException",
"error": "unknown error",
"message": "Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.\nActive sessions are[]",
"stackTrace": [
{
"className": "org.openqa.grid.internal.ActiveTestSessions",
"fileName": "ActiveTestSessions.java",
"lineNumber": 120,
"methodName": "getExistingSession"
},
{
"className": "org.openqa.grid.internal.DefaultGridRegistry",
"fileName": "DefaultGridRegistry.java",
"lineNumber": 387,
"methodName": "getExistingSession"
},
{
"className": "org.openqa.grid.web.servlet.handler.RequestHandler",
"fileName": "RequestHandler.java",
"lineNumber": 241,
"methodName": "getSession"
},
{
"className": "org.openqa.grid.web.servlet.handler.RequestHandler",
"fileName": "RequestHandler.java",
"lineNumber": 123,
"methodName": "process"
},
{
"className": "org.openqa.grid.web.servlet.DriverServlet",
"fileName": "DriverServlet.java",
"lineNumber": 85,
"methodName": "process"
},
{
"className": "org.openqa.grid.web.servlet.DriverServlet",
"fileName": "DriverServlet.java",
"lineNumber": 63,
"methodName": "doGet"
},
{
"className": "javax.servlet.http.HttpServlet",
"fileName": "HttpServlet.java",
"lineNumber": 687,
"methodName": "service"
},
{
"className": "javax.servlet.http.HttpServlet",
"fileName": "HttpServlet.java",
"lineNumber": 790,
"methodName": "service"
},
{
"className": "org.seleniumhq.jetty9.servlet.ServletHolder",
"fileName": "ServletHolder.java",
"lineNumber": 865,
"methodName": "handle"
},
{
"className": "org.seleniumhq.jetty9.servlet.ServletHandler",
"fileName": "ServletHandler.java",
"lineNumber": 535,
"methodName": "doHandle"
},
{
"className": "org.seleniumhq.jetty9.server.handler.ScopedHandler",
"fileName": "ScopedHandler.java",
"lineNumber": 146,
"methodName": "handle"
},
{
"className": "org.seleniumhq.jetty9.security.SecurityHandler",
"fileName": "SecurityHandler.java",
"lineNumber": 548,
"methodName": "handle"
},
{
"className": "org.seleniumhq.jetty9.server.handler.HandlerWrapper",
"fileName": "HandlerWrapper.java",
"lineNumber": 132,
"methodName": "handle"
},
{
"className": "org.seleniumhq.jetty9.server.handler.ScopedHandler",
"fileName": "ScopedHandler.java",
"lineNumber": 257,
"methodName": "nextHandle"
},
{
"className": "org.seleniumhq.jetty9.server.session.SessionHandler",
"fileName": "SessionHandler.java",
"lineNumber": 1595,
"methodName": "doHandle"
},
{
"className": "org.seleniumhq.jetty9.server.handler.ScopedHandler",
"fileName": "ScopedHandler.java",
"lineNumber": 255,
"methodName": "nextHandle"
},
{
"className": "org.seleniumhq.jetty9.server.handler.ContextHandler",
"fileName": "ContextHandler.java",
"lineNumber": 1340,
"methodName": "doHandle"
},
{
"className": "org.seleniumhq.jetty9.server.handler.ScopedHandler",
"fileName": "ScopedHandler.java",
"lineNumber": 203,
"methodName": "nextScope"
},
{
"className": "org.seleniumhq.jetty9.servlet.ServletHandler",
"fileName": "ServletHandler.java",
"lineNumber": 473,
"methodName": "doScope"
},
{
"className": "org.seleniumhq.jetty9.server.session.SessionHandler",
"fileName": "SessionHandler.java",
"lineNumber": 1564,
"methodName": "doScope"
},
{
"className": "org.seleniumhq.jetty9.server.handler.ScopedHandler",
"fileName": "ScopedHandler.java",
"lineNumber": 201,
"methodName": "nextScope"
},
{
"className": "org.seleniumhq.jetty9.server.handler.ContextHandler",
"fileName": "ContextHandler.java",
"lineNumber": 1242,
"methodName": "doScope"
},
{
"className": "org.seleniumhq.jetty9.server.handler.ScopedHandler",
"fileName": "ScopedHandler.java",
"lineNumber": 144,
"methodName": "handle"
},
{
"className": "org.seleniumhq.jetty9.server.handler.HandlerWrapper",
"fileName": "HandlerWrapper.java",
"lineNumber": 132,
"methodName": "handle"
},
{
"className": "org.seleniumhq.jetty9.server.Server",
"fileName": "Server.java",
"lineNumber": 503,
"methodName": "handle"
},
{
"className": "org.seleniumhq.jetty9.server.HttpChannel",
"fileName": "HttpChannel.java",
"lineNumber": 364,
"methodName": "handle"
},
{
"className": "org.seleniumhq.jetty9.server.HttpConnection",
"fileName": "HttpConnection.java",
"lineNumber": 260,
"methodName": "onFillable"
},
{
"className": "org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback",
"fileName": "AbstractConnection.java",
"lineNumber": 305,
"methodName": "succeeded"
},
{
"className": "org.seleniumhq.jetty9.io.FillInterest",
"fileName": "FillInterest.java",
"lineNumber": 103,
"methodName": "fillable"
},
{
"className": "org.seleniumhq.jetty9.io.ChannelEndPoint$2",
"fileName": "ChannelEndPoint.java",
"lineNumber": 118,
"methodName": "run"
},
{
"className": "org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill",
"fileName": "EatWhatYouKill.java",
"lineNumber": 333,
"methodName": "runTask"
},
{
"className": "org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill",
"fileName": "EatWhatYouKill.java",
"lineNumber": 310,
"methodName": "doProduce"
},
{
"className": "org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill",
"fileName": "EatWhatYouKill.java",
"lineNumber": 168,
"methodName": "tryProduce"
},
{
"className": "org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill",
"fileName": "EatWhatYouKill.java",
"lineNumber": 126,
"methodName": "run"
},
{
"className": "org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread",
"fileName": "ReservedThreadExecutor.java",
"lineNumber": 366,
"methodName": "run"
},
{
"className": "org.seleniumhq.jetty9.util.thread.QueuedThreadPool",
"fileName": "QueuedThreadPool.java",
"lineNumber": 765,
"methodName": "runJob"
},
{
"className": "org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2",
"fileName": "QueuedThreadPool.java",
"lineNumber": 683,
"methodName": "run"
},
{
"className": "java.lang.Thread",
"fileName": "Thread.java",
"lineNumber": 748,
"methodName": "run"
}
],
"stacktrace": "org.openqa.grid.common.exception.GridException: Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.\nActive sessions are[]\n\tat org.openqa.grid.internal.ActiveTestSessions.getExistingSession(ActiveTestSessions.java:120)\n\tat org.openqa.grid.internal.DefaultGridRegistry.getExistingSession(DefaultGridRegistry.java:387)\n\tat org.openqa.grid.web.servlet.handler.RequestHandler.getSession(RequestHandler.java:241)\n\tat org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:123)\n\tat org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:85)\n\tat org.openqa.grid.web.servlet.DriverServlet.doGet(DriverServlet.java:63)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:687)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:790)\n\tat org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:865)\n\tat org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:146)\n\tat org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548)\n\tat org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)\n\tat org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)\n\tat org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)\n\tat org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)\n\tat org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)\n\tat org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1242)\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:144)\n\tat org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\n\tat org.seleniumhq.jetty9.server.Server.handle(Server.java:503)\n\tat org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:364)\n\tat org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:260)\n\tat org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)\n\tat org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:103)\n\tat org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)\n\tat org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)\n\tat org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)\n\tat org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)\n\tat org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)\n\tat org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)\n\tat org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)\n\tat org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)\n\tat java.lang.Thread.run(Thread.java:748)\n"
}
}
/wd/hub/sessions
请求可能是什么问题?
该服务器正常响应所有其他请求(例如/wd/hub/session
)。