如何将appium连接到扩展的Selenium Grid?

时间:2019-09-11 14:11:09

标签: selenium appium

我创建了一个类来按照以下说明扩展硒网格:https://www.swtestacademy.com/extend-selenium-grid 连接硒节点不是问题(只要我扩展了硒版本3.12 [3.141.59将不允许连接])。我的问题是我无法连接一个鸦片节点。

我在同一台机器上运行服务器和节点。 服务器命令:java -jar selenium-server-0.0.1-SNAPSHOT-jar-with-dependencies.jar -role hub

Appium节点命令:appium -p 4723 --nodeconfig node.json

node.json:
{  "capabilities":
  [
    {
      "browserName": "chrome",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "internet explorer",
      "maxInstances": 1,
      "seleniumProtocol": "WebDriver"
    }
  ],
  "proxy": "com.swtestacademy.ExtendedProxy",
  "maxSession": 1,
  "port": -1,
  "register": true,
  "registerCycle": 5000,
  "hub": "http://localhost:4444/grid/register",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {}
}

[Appium]向网格注册的请求失败:500-“ \ n \ n \ n错误500服务器错误\ n \ n

HTTP错误500

\ n

问题访问/ grid / register。原因:\ n

    Server Error

原因:

java.lang.NullPointerException\r\n\tat org.openqa.grid.web.servlet.RegistrationServlet.considerV2Json(RegistrationServlet.java:172)\r\n\tat org.openqa.grid.web.servlet.RegistrationServlet.process(RegistrationServlet.java:97)\r\n\tat org.openqa.grid.web.servlet.RegistrationServlet.doPost(RegistrationServlet.java:70)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:665)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:750)\r\n\tat org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:860)\r\n\tat org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)\r\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\r\n\tat org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548)\r\n\tat org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\r\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)\r\n\tat org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)\r\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)\r\n\tat org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)\r\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)\r\n\tat org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)\r\n\tat org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)\r\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)\r\n\tat org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155)\r\n\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\r\n\tat org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\r\n\tat org.seleniumhq.jetty9.server.Server.handle(Server.java:530)\r\n\tat org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:347)\r\n\tat org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:256)\r\n\tat org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)\r\n\tat org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:102)\r\n\tat org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)\r\n\tat org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)\r\n\tat org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)\r\n\tat org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)\r\n\tat org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)\r\n\tat java.lang.Thread.run(Thread.java:748)\r\n
\ n
http:/ /eclipse.org/jetty \“>由Jetty提供支持:// 9.4.z-SNAPSHOT
\ n \ n \ n \ n”

1 个答案:

答案 0 :(得分:0)

似乎您错过了服务器地址--address和执行-role node选项的-nodeConfig参数。

尝试使用以下命令运行节点:

appium --address 127.0.0.1 -role node -nodeConfig node.json

-a--address

请参阅:

Node Configuration

Appium Server Arguments