Selendoid - 创建会话

时间:2014-01-29 08:57:45

标签: selenium selenium-webdriver

我尝试使用Selendroid(版本0.7.0)来测试移动版网站。无法启动会话。启动会话的有效参数如何?

php / http例子喜欢。

Selendroid状态:

    curl 'http://localhost:4444/wd/hub/status'
    {
        "status":0,
       "value":{
        "supportedApps":[

        ],
          "os":{
            "arch":"amd64",
             "name":"Linux",
             "version":"3.2.0-58-generic"
          },
          "build":{
            "browserName":"selendroid",
             "version":"0.7.0"
          },
          "supportedDevices":[
             {
                 "screenSize":"600x800",
                "model":"VirtualBox",
                "emulator":false,
                "androidTarget":"ANDROID18"
             },
             {
                 "screenSize":"600x800",
                "model":"VirtualBox",
                "emulator":false,
                "androidTarget":"ANDROID18"
             },
             {
                 "screenSize":"600x800",
                "model":"VirtualBox",
                "emulator":false,
                "androidTarget":"ANDROID18"
             }
          ]
       }
    }

创建会话:

    curl -d '{"desiredCapabilities":{"browserName":"selendroid","emulator":{"androidTarget":"ANDROID18"}}}' http://localhost:4444/wd/hub/session
    {
        "status":33,
       "sessionId":"",
       "value":{
        "message":"The requested application under test is not configured in selendroid server.",
          "class":"io.selendroid.exceptions.SessionNotCreatedException",
          "stacktrace":[
            "io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStandaloneDriver.java:257)",
            "io.selendroid.server.handler.CreateSessionHandler.handle(CreateSessionHandler.java:42)",
            "io.selendroid.server.SelendroidServlet.handleRequest(SelendroidServlet.java:130)",
            "io.selendroid.server.BaseServlet.handleHttpRequest(BaseServlet.java:81)",
            "org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)",
            "org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)",
            "org.webbitserver.handler.PathMatchHandler.handleHttpRequest(PathMatchHandler.java:33)",
            "org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)",
            "org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)",
            "org.webbitserver.handler.DateHeaderHandler.handleHttpRequest(DateHeaderHandler.java:21)",
            "org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)",
            "org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:62)",
            "org.webbitserver.handler.ServerHeaderHandler.handleHttpRequest(ServerHeaderHandler.java:25)",
            "org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:78)",
            "org.webbitserver.netty.NettyHttpControl.nextHandler(NettyHttpControl.java:67)",
            "org.webbitserver.netty.NettyHttpChannelHandler$2.run(NettyHttpChannelHandler.java:77)",
            "java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)",
            "java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)",
            "java.lang.Thread.run(Thread.java:744)"
        ]
       }
    }

1 个答案:

答案 0 :(得分:0)

curl命令中的功能错误。请使用这个:

curl -d '{"desiredCapabilities":{"browserName":"android","emulator":True,"androidTarget":"ANDROID16"}}' http://localhost:4444/wd/hub/session

要测试移动网络,您必须使用浏览器名称“android”。属性“模拟器”定义是否应使用Android模拟器或硬件设备。 “androidTarget”是可选的。