添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
旅行中的钥匙  ·  Traefik v2 unable to ...·  3 月前    · 
睡不着的荒野  ·  Compiling Squid | ...·  5 月前    · 
飘逸的四季豆  ·  7. Declarative REST ...·  8 月前    · 

I am working on automating testcases for a mobile application in Python and I have recently started facing an issue. Thing were working completely fine earlier but now for some reason the following error pops up. Any idea on how to solve this issue?

selenium.common.exceptions.InvalidSessionIdException: Message: The session identified by 25030467-b3ad-4f74-a6ce-10f8ffab97c3 is not known
Stacktrace:
io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 25030467-b3ad-4f74-a6ce-10f8ffab97c3 is not known
at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:54)
at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:266)
at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:260)
at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:552)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
at java.lang.Thread.run(Thread.java:920)

Solution: What you need to do is to uninstall uiautomator apps. Go to Android settings → Apps. Then search for uiautomator, 2 apps will pop up. Uninstall those and you’ll be good to go. This error occurs when the sessions crash over and over again so change your code in such a way that if it causes some error, it automatically quits the driver.

Hi, it happened to me now for the second time.
I am testing both android and ios using mac. As well I am using one appium port.
I quit all the emulators/simulators I had open and any appium server as well.
Then, I relaunched the only simulator I wanted to use and an appium server and all worked fine again.
Hope it helps.

Additionally, I think it is an appium related issue since I saw somewhere in appium logs that it is intentionally switching sessions ids…

As well, maybe it is worth to try upload an issue in appium github repo and see there, or here as well.

Which appium version do you use? I updated lately and it didn’t happen to me before.

@ido_oserovitz @Umer_Saeed
Could you please confirm how the issue got resolved? I’m seeing the same issue now

"Encountered internal error running command: io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 368fb888-8cf7-4701-927c-a1b9f2768cd7 is not known "

What you need to do is to uninstall uiautomator apps. Go to Android settings -> Apps. Then search for uiautomator, 2 apps will pop up. Uninstall those and you’ll be good to go. This error occurs when the sessions crash over and over again so change your code in such a way that if it causes some error, it automatically quits the driver.

Thanks @Umer_Saeed , your suggestion solve the issue.

To be specific, I uninstalled these two apps

  • io.appium.uiautomator2.server
  • io.appium.uiautomator2.server.test
  • I use these commands to uninstall in such situations:

    adb uninstall io.appium.uiautomator2.server
    adb uninstall io.appium.uiautomator2.server.test
    adb uninstall io.appium.unlock
    adb uninstall io.appium.settings

    hey @Umer_Saeed lately I am working on automation scripts using YAML, R2
    While starting session in appium- I am getting this error-
    Encountered internal error running command: io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 97542aaa-f400-4677-b6f0-f89b0ef8a754 is not known

    I can’t find uiautomator in Android settings -> Apps