尝试使用 Appium 检查器启动会话时,我不断收到错误消息。我尝试休息并重新启动设备,但仍然面临同样的问题。当我卸载并重新安装 Appium 检查器时,该问题曾经得到解决,但该解决方案显然不可行。
Json 配置功能(Appium 检查器)
{
"platformName": "Android",
"appium:platformVersion": "12",
"appium:deviceName": "Pixel 7 API 31 (S)",
"appium:app": "D:\\Automation_code\\TestAutomation\\test\\app\\Android_app_demo-244.apk",
"appium:automationName": "UIAutomator2"
}
命令提示符错误
[AndroidUiautomator2Driver@e71f (3ca9865d)] Got response with status 404: {"sessionId":"317d63c4-1b69-44c6-a43b-6ad848e5c6da","value":{"error":"invalid session id","message":"The session identified by 317d63c4-1b69-44c6-a43b-6ad848e5c6da is not known","stacktrace":"io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 317d63c4-1b69-44c6-a43b-6ad848e5c6da 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:259)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:253)\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
[HTTP] <-- GET /session/3ca9865d-93b8-4e32-a9b5-d3f3e481d007/source 404 9 ms - 3691
完全错误
[AndroidUiautomator2Driver@e71f (3ca9865d)] Encountered internal error running command: io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 317d63c4-1b69-44c6-a43b-6ad848e5c6da is not known
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:54)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:259)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:253)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:77)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:552)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at java.lang.Thread.run(Thread.java:920)
[AndroidUiautomator2Driver@e71f (3ca9865d)]
[HTTP] <-- GET /session/3ca9865d-93b8-4e32-a9b5-d3f3e481d007/screenshot 404 111 ms - 3691
[HTTP]
[HTTP] --> GET /session/3ca9865d-93b8-4e32-a9b5-d3f3e481d007/window/rect
[HTTP] {}
[AndroidUiautomator2Driver@e71f (3ca9865d)] Calling AppiumDriver.getWindowRect() with args: ["3ca9865d-93b8-4e32-a9b5-d3f3e481d007"]
[AndroidUiautomator2Driver@e71f (3ca9865d)] Matched '/window/current/size' to command name 'getWindowSize'
[AndroidUiautomator2Driver@e71f (3ca9865d)] Proxying [GET /window/current/size] to [GET http://127.0.0.1:8200/session/317d63c4-1b69-44c6-a43b-6ad848e5c6da/window/current/size] with no body
[AndroidUiautomator2Driver@e71f (3ca9865d)] Got response with status 404: {"sessionId":"317d63c4-1b69-44c6-a43b-6ad848e5c6da","value":{"error":"invalid session id","message":"The session identified by 317d63c4-1b69-44c6-a43b-6ad848e5c6da is not known","stacktrace":"io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 317d63c4-1b69-44c6-a43b-6ad848e5c6da 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:259)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:253)\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@e71f (3ca9865d)] Encountered internal error running command: io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 317d63c4-1b69-44c6-a43b-6ad848e5c6da is not known
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:54)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:259)
[AndroidUiautomator2Driver@e71f (3ca9865d)] at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:253)
尝试运行 Appium 检查器而不遇到无效的会话 ID 错误 在命令提示符下执行以下命令
appium -p 4724 --allow-cors
()
我尝试这个并为我工作。我也希望对你有帮助 https://github.com/appium/appium/issues/7069#issuecomment-452295249