[W3C] Matched W3C error code 'invalid session id' to NoSuchDriverError
[AndroidUiautomator2Driver@c1c1 (b6e10365)] Encountered internal error running command: io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 1538a83e-8c95-4f11-9fae-7ce2c7358690 is not known
复现步骤
使用其他模拟器跑脚本,没有报错。正常执行
使用其他server 连接此模拟器,发现错误。基本可以定位到错误就是由于模拟器导致。
经过查看日志进一步定位后,发现模拟器中的 driver 的server 出现crash。如下所示:
[AndroidUiautomator2Driver@c1c1 (b6e10365)] Proxying [POST /element] to [POST http://127.0.0.1:8200/session/1538a83e-8c95-4f11-9fae-7ce2c7358690/element] with body: {"strategy":"xpath","selector":"//*[@text='Battery']","context":"","multiple":false}
[AndroidUiautomator2Driver@c1c1 (b6e10365)] Got response with status 404: {"sessionId":"1538a83e-8c95-4f11-9fae-7ce2c7358690","value":{"error":"invalid session id","message":"The session identified by 1538a83e-8c95-4f11-9fae-7ce2c7358690 is not known","stacktrace":"io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 1538a83e-8c95-4f11-9fae-7ce2c7358690 is not known\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:54)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:277)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:271)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:77)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:3...
[W3C] Matched W3C error code 'invalid session id' to NoSuchDriverError
[AndroidUiautomator2Driver@c1c1 (b6e10365)] Encountered internal error running command: io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 1538a83e-8c95-4f11-9fae-7ce2c7358690 is not known
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:54)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:277)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:271)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:77)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:552)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
[AndroidUiautomator2Driver@c1c1 (b6e10365)] at java.lang.Thread.run(Thread.java:1012)
[AndroidUiautomator2Driver@c1c1 (b6e10365)]
[HTTP] <-- POST /session/b6e10365-b20a-4f5e-863b-c418c8a83a9a/element 404 64 ms - 3692
[HTTP]
[Instrumentation] INSTRUMENTATION_RESULT: shortMsg=Process crashed.
[Instrumentation] INSTRUMENTATION_CODE: 0
[Instrumentation] The process has exited with code 0