新手区 selendroid 初学碰到的问题

向阳 · 2015年01月15日 · 最后由 向阳 回复于 2015年01月19日 · 1918 次阅读

我按照官方的例子修改了一下代码,然后就一直运行出错:
代码:

import unittest
from selenium import webdriver

########################################################################
class FindElementTest(unittest.TestCase):
    """打开 apk 找到"""
    #----------------------------------------------------------------------
    def setUp(self):
        """"""
        desired_capabilities={'aut':'com.example.bebb:1.9.1'}
        self.driver=webdriver.Remote(
            desired_capabilities=desired_capabilities
        )

        self.driver.implicitly_wait(30)
        #全局定义超时,处理find_element_by 等操作超时均为30s
    #----------------------------------------------------------------------
    def test_find_element_by_id(self):
        """"""
        self.driver.get('and-activity://com.example.bebb.PlashScreen')
        #print '11'
        self.assertTrue("and-activity://PlashScreen" in self.driver.current_url)
        print self.driver.current_url

        closeWebView=self.driver.find_element_by_class_name('android.widget.ImageView')
        closeWebView.click
        self.driver.tap([(200,50)],1)


    #----------------------------------------------------------------------
    def tearDown(self):
        """tearDown"""
        self.driver.quit()

if __name__=="__main__":
    unittest.main()

报错:

E
======================================================================
ERROR: test_find_element_by_id (__main__.FindElementTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "d:\python\py_workspace\selendroid\selendroid_ceb01.py", line 12, in setUp
    desired_capabilities=desired_capabilities
  File "D:\Program File\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 73, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "D:\Program File\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 121, in start_session
    'desiredCapabilities': desired_capabilities,
  File "D:\Program File\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 173, in execute
    self.error_handler.check_response(response)
  File "D:\Program File\python\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 166, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: Error starting Selendroid session
io.selendroid.exceptions.SessionNotCreatedException: Error starting Selendroid session

    at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStandaloneDriver.java:277)

    at io.selendroid.server.handler.CreateSessionHandler.handle(CreateSessionHandler.java:44)

    at io.selendroid.server.SelendroidServlet.handleRequest(SelendroidServlet.java:143)

    at io.selendroid.server.BaseServlet.handleHttpRequest(BaseServlet.java:67)

    at io.selendroid.server.http.ServerHandler.channelRead(ServerHandler.java:53)

    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)

    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)

    at io.netty.handler.traffic.AbstractTrafficShapingHandler.channelRead(AbstractTrafficShapingHandler.java:223)

    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)

    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)

    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)

    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)

    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)

    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)

    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:148)

    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)

    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)

    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)

    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:125)

    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)

    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)

    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)

    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)

    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)

    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)

    at java.lang.Thread.run(Unknown Source)

Caused by: io.selendroid.exceptions.SessionNotCreatedException: The requested application under test is not configured in selendroid server.

    at io.selendroid.server.model.SelendroidStandaloneDriver.getAndroidApp(SelendroidStandaloneDriver.java:361)

    at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStandaloneDriver.java:192)

    ... 25 more




----------------------------------------------------------------------
Ran 1 test in 4.537s

FAILED (errors=1)

我看的是说这部分不对:

self.driver=webdriver.Remote(
            desired_capabilities=desired_capabilities
        )

但是就是不知道为什么不对,我用原代码就可以通过,原代码里边测试的 apk 就是 selendroid-test-app-0.12.0.apk。

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 8 条回复 时间 点赞

server 的日志

#1 楼 @lihuazhang

一月 15, 2015 12:56:49 下午 io.selendroid.server.model.SelendroidStandaloneDriver createNewTestSessi
on
SEVERE: Error occurred while starting Selendroid session
io.selendroid.exceptions.SessionNotCreatedException: The requested application under test is not con
figured in selendroid server.
        at io.selendroid.server.model.SelendroidStandaloneDriver.getAndroidApp(SelendroidStandaloneD
river.java:361)
        at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStan
daloneDriver.java:192)
        at io.selendroid.server.handler.CreateSessionHandler.handle(CreateSessionHandler.java:44)
        at io.selendroid.server.SelendroidServlet.handleRequest(SelendroidServlet.java:143)
        at io.selendroid.server.BaseServlet.handleHttpRequest(BaseServlet.java:67)
        at io.selendroid.server.http.ServerHandler.channelRead(ServerHandler.java:53)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.traffic.AbstractTrafficShapingHandler.channelRead(AbstractTrafficShaping
Handler.java:223)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:1
03)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.ja
va:148)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.jav
a:125)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:1
16)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadF
actory.java:137)
        at java.lang.Thread.run(Unknown Source)

一月 15, 2015 12:56:49 下午 io.selendroid.server.model.SelendroidStandaloneDriver createNewTestSessi
on
SEVERE: Error occurred while starting Selendroid session
io.selendroid.exceptions.SessionNotCreatedException: The requested application under test is not con
figured in selendroid server.
        at io.selendroid.server.model.SelendroidStandaloneDriver.getAndroidApp(SelendroidStandaloneD
river.java:361)
        at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStan
daloneDriver.java:192)
        at io.selendroid.server.handler.CreateSessionHandler.handle(CreateSessionHandler.java:44)
        at io.selendroid.server.SelendroidServlet.handleRequest(SelendroidServlet.java:143)
        at io.selendroid.server.BaseServlet.handleHttpRequest(BaseServlet.java:67)
        at io.selendroid.server.http.ServerHandler.channelRead(ServerHandler.java:53)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.traffic.AbstractTrafficShapingHandler.channelRead(AbstractTrafficShaping
Handler.java:223)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:1
03)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.ja
va:148)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.jav
a:125)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:1
16)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadF
actory.java:137)
        at java.lang.Thread.run(Unknown Source)

一月 15, 2015 12:56:49 下午 io.selendroid.server.model.SelendroidStandaloneDriver createNewTestSessi
on
SEVERE: Error occurred while starting Selendroid session
io.selendroid.exceptions.SessionNotCreatedException: The requested application under test is not con
figured in selendroid server.
        at io.selendroid.server.model.SelendroidStandaloneDriver.getAndroidApp(SelendroidStandaloneD
river.java:361)
        at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStan
daloneDriver.java:192)
        at io.selendroid.server.handler.CreateSessionHandler.handle(CreateSessionHandler.java:44)
        at io.selendroid.server.SelendroidServlet.handleRequest(SelendroidServlet.java:143)
        at io.selendroid.server.BaseServlet.handleHttpRequest(BaseServlet.java:67)
        at io.selendroid.server.http.ServerHandler.channelRead(ServerHandler.java:53)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.traffic.AbstractTrafficShapingHandler.channelRead(AbstractTrafficShaping
Handler.java:223)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:1
03)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.ja
va:148)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.jav
a:125)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:1
16)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadF
actory.java:137)
        at java.lang.Thread.run(Unknown Source)

一月 15, 2015 12:56:49 下午 io.selendroid.server.model.SelendroidStandaloneDriver createNewTestSessi
on
SEVERE: Error occurred while starting Selendroid session
io.selendroid.exceptions.SessionNotCreatedException: The requested application under test is not con
figured in selendroid server.
        at io.selendroid.server.model.SelendroidStandaloneDriver.getAndroidApp(SelendroidStandaloneD
river.java:361)
        at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStan
daloneDriver.java:192)
        at io.selendroid.server.handler.CreateSessionHandler.handle(CreateSessionHandler.java:44)
        at io.selendroid.server.SelendroidServlet.handleRequest(SelendroidServlet.java:143)
        at io.selendroid.server.BaseServlet.handleHttpRequest(BaseServlet.java:67)
        at io.selendroid.server.http.ServerHandler.channelRead(ServerHandler.java:53)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.traffic.AbstractTrafficShapingHandler.channelRead(AbstractTrafficShaping
Handler.java:223)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:1
03)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.ja
va:148)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.jav
a:125)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:1
16)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadF
actory.java:137)
        at java.lang.Thread.run(Unknown Source)

一月 15, 2015 12:56:49 下午 io.selendroid.server.model.SelendroidStandaloneDriver createNewTestSessi
on
SEVERE: Error occurred while starting Selendroid session
io.selendroid.exceptions.SessionNotCreatedException: The requested application under test is not con
figured in selendroid server.
        at io.selendroid.server.model.SelendroidStandaloneDriver.getAndroidApp(SelendroidStandaloneD
river.java:361)
        at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStan
daloneDriver.java:192)
        at io.selendroid.server.handler.CreateSessionHandler.handle(CreateSessionHandler.java:44)
        at io.selendroid.server.SelendroidServlet.handleRequest(SelendroidServlet.java:143)
        at io.selendroid.server.BaseServlet.handleHttpRequest(BaseServlet.java:67)
        at io.selendroid.server.http.ServerHandler.channelRead(ServerHandler.java:53)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.traffic.AbstractTrafficShapingHandler.channelRead(AbstractTrafficShaping
Handler.java:223)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:1
03)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.ja
va:148)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.jav
a:125)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:1
16)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadF
actory.java:137)
        at java.lang.Thread.run(Unknown Source)

一月 15, 2015 12:56:49 下午 io.selendroid.server.handler.CreateSessionHandler handle
SEVERE: Error while creating new session
io.selendroid.exceptions.SessionNotCreatedException: Error starting Selendroid session
        at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStan
daloneDriver.java:277)
        at io.selendroid.server.handler.CreateSessionHandler.handle(CreateSessionHandler.java:44)
        at io.selendroid.server.SelendroidServlet.handleRequest(SelendroidServlet.java:143)
        at io.selendroid.server.BaseServlet.handleHttpRequest(BaseServlet.java:67)
        at io.selendroid.server.http.ServerHandler.channelRead(ServerHandler.java:53)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.traffic.AbstractTrafficShapingHandler.channelRead(AbstractTrafficShaping
Handler.java:223)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:1
03)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.ja
va:148)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
ntext.java:333)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerCont
ext.java:319)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.jav
a:125)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:1
16)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadF
actory.java:137)
        at java.lang.Thread.run(Unknown Source)
Caused by: io.selendroid.exceptions.SessionNotCreatedException: The requested application under test
 is not configured in selendroid server.
        at io.selendroid.server.model.SelendroidStandaloneDriver.getAndroidApp(SelendroidStandaloneD
river.java:361)
        at io.selendroid.server.model.SelendroidStandaloneDriver.createNewTestSession(SelendroidStan
daloneDriver.java:192)
        ... 25 more

@lihuazhang 谢谢~~ 我再看看

又用了几天 selendroid,发现可能是我启动服务的方式不对;
java -jar .\selendroid-standalone-0.12.0-with-dependencies.jar -app .\selendroid-test-app-0.12.0.apk启动服务时,-app后边的测试 apk 应和脚本中被测的 apk 一致;这样启动服务后手机里边会增加一个应用Selendroid:

如果要测其他脚本(其他安卓包),就要重启服务,重启服务的时候更换 apk 名,要不就直接报错:

WebDriverException: Message: Error starting Selendroid session
io.selendroid.exceptions.SessionNotCreatedException: Error starting Selendroid session

重新启动服务后,手机里边会又增加一个Selendroid应用:

我用的是安卓模拟器,有时候执行脚本的就是没反应,经常adb devices发现不了设备;可能这也是个原因。
谢谢 lihuazhang

#5 楼 @face_south 这个 selendroid 是测试 apk

你得了解下 instruments 再来看 selendroid

@lihuazhang 好的 我找文档好好看看

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册