在Selenium Grid上通过Appium注册Android节点时出错

时间:2016-07-19 07:30:03

标签: selenium nullpointerexception appium selenium-grid

当我尝试在本地运行的Selenium Grid上注册Appium和Android功能时,它会出错

以下是我的配置JSON文件: -

{
"capabilties":
[
    {
     "deviceName": "8788beed",
     "version":"6.0.1",
     "maxInstances": 3,
     "platform":"WINDOWS",
     "platformName":"ANDROID"
    }
],
"configuration":
{
    "cleanUpCycle": 2000,
    "timeout": 30000,
    "host": "192.168.1.43",
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "url":"http://192.168.1.43:4723/wd/hub",
    "port": 4723,
    "maxSession": 6,
    "register": true,
    "registerCycle": 5000,
    "hubPort": 4444,
    "hubHost": "192.168.1.43"
}
}

我尝试过几十次更改功能和配置,但没有白费。

每次我尝试在网格上注册Appium时都会抛出这个错误: -

2016-07-19 12:16:23.135:INFO:osjs.AbstractConnector:Started   SocketConnector@0.0.
0.0:4444
2016-07-19 12:18:07.740:WARN:osjs.ServletHandler:/grid/register
java.lang.NullPointerException
    at  org.openqa.grid.common.RegistrationRequest.getNewInstance(Registratio
nRequest.java:277)
    at  org.openqa.grid.web.servlet.RegistrationServlet.process(RegistrationS
ervlet.java:75)
    at  org.openqa.grid.web.servlet.RegistrationServlet.doPost(RegistrationSe
rvlet.java:60)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at  org.seleniumhq.jetty7.servlet.ServletHolder.handle(ServletHolder.java
:565)
    at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle(ServletHandler.
java:479)
    at  org.seleniumhq.jetty7.server.session.SessionHandler.doHandle(SessionH
andler.java:225)
    at  org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle(ContextH
andler.java:1031)
    at org.seleniumhq.jetty7.servlet.ServletHandler.doScope(ServletHandler.j
ava:406)
    at  org.seleniumhq.jetty7.server.session.SessionHandler.doScope(SessionHa
ndler.java:186)
    at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope(ContextHa
ndler.java:965)
    at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle(ScopedHandl
er.java:117)
    at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle(HandlerWra
pper.java:111)
    at org.seleniumhq.jetty7.server.Server.handle(Server.java:349)
    at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest(Abs
tractHttpConnection.java:452)
    at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest(Blo
ckingHttpConnection.java:47)
    at org.seleniumhq.jetty7.server.AbstractHttpConnection.content(AbstractH
ttpConnection.java:894)
    at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.co
ntent(AbstractHttpConnection.java:948)
    at org.seleniumhq.jetty7.http.HttpParser.parseNext(HttpParser.java:857)
    at org.seleniumhq.jetty7.http.HttpParser.parseAvailable(HttpParser.java:
235)
    at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle(BlockingHt
tpConnection.java:66)
    at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.ru
n(SocketConnector.java:254)
    at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob(QueuedThrea
dPool.java:599)
    at org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3.run(QueuedThread
Pool.java:534)
    at java.lang.Thread.run(Thread.java:745)
2016-07-19 12:18:12.511:WARN:osjs.ServletHandler:/grid/register

java.lang.NullPointerException

我尝试使用以下命令从GUI和命令行运行Appium: -

appium --nodeconfig C:\SeleniumGrid\androidNodeConfig.json

我无法注册Appium android节点。请帮忙。

感谢。

1 个答案:

答案 0 :(得分:0)

问题出在JSON中。

我从某个地方复制了JSON,因此,其中有一些隐藏的错误,我还没有。

但是当我创建一个新的空JSON文件并手动编写与前一个JSON文件完全相同内容的文件时,我能够注册。

听起来很奇怪,但有时候生活如何。 ;)