通过selenium网格运行Android测试时收到错误

时间:2018-03-16 09:28:08

标签: selenium appium selenium-grid appium-android

当我尝试直接通过appium执行我的android测试时,它运行正常。但是当我尝试通过selenium网格执行它时,它会在集线器中给我这个错误。

        <div class="form-group">
            <label class="head-label">Date Range:</label>
            <div class="input-group  filter-calendar">
            <my-date-range-picker name="mydaterange" [options]="myDateRangePickerOptions" [(ngModel)]="selectedFilters.date"></my-date-range-picker>
            </div>
        </div>

以下是hubConfig:

org.openqa.grid.common.exception.CapabilityNotPresentOnTheGridException: cannot find : Capabilities {app: /Users/prakashp/IdeaProject..., appPackage: com.ytlcomms.ymca, appiumVersion: 1.7.2, autoGrantPermissions: true, automationName: UiAutomator2, avd: Pixel_2_API_22, browserName: android, clearSystemFiles: true, deviceName: Pixel_2_API_22, fullReset: false, noReset: false, platform: ANDROID, platformName: android, version: 5.1}
    at org.openqa.grid.internal.ProxySet.verifyAbilityToHandleDesiredCapabilities(ProxySet.java:153)
    at org.openqa.grid.internal.DefaultGridRegistry.addNewSessionRequest(DefaultGridRegistry.java:217)
    at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:111)
    at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:86)
    at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:860)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.seleniumhq.jetty9.server.Server.handle(Server.java:530)
    at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:347)
    at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:256)
    at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:102)
    at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
    at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
    at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    at org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
    at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
    at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
    at java.lang.Thread.run(Thread.java:748)

下面是nodeconfig(不确定它是否正确)

{
  "host": "10.24.4.179",
  "port": 4654,
  "newSessionWaitTimeout": -1,
  "servlets" : [],
  "prioritizer": null,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 5000,

  "cleanUpCycle": 5000,
  "timeout": 300000,
  "browserTimeout": 0,
  "maxSession": 5,
  "jettyMaxThreads":-1
}

然后在代码中我设置了以下功能:

{
  "capabilities": [
    {
      "platformname": "Android",
      "platformVersion": "5.1.1",
      "deviceName": "Pixel_2_API_22",
      "app": "/Users/prakashp/IdeaProjects/ymca/src/test/resources/YMCA.apk",
      "newCommandTimeout": 60,
      "browserName": "android"
    }
  ],

  "cleanUpCycle": 2000,
  "timeout": 30000,
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "url": "http://10.24.4.179:4501/wd/hub",
  "host": "10.24.4.179",
  "port": "4501",
  "maxSession": 1,
  "register": true,
  "registerCycle": 5000,
  "hubPort": "4654",
  "hubHost": "10.24.4.179"
}

请帮助我,因为我不熟悉移动自动化。

0 个答案:

没有答案